Skip to content

Commit

Permalink
Only plot circuit size if "plot" feature is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
fkettelhoit committed Aug 12, 2024
1 parent 705815f commit 284b8e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ serde = { version = "1.0", features = ["derive"], optional = true }

[features]
bin = ["clap"]
plot = []

[dev-dependencies]
quickcheck = "1"
Expand Down
16 changes: 10 additions & 6 deletions tests/circuit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::collections::HashMap;

use garble_lang::{compile, compile_with_constants, literal::Literal, token::UnsignedNumType};
use garble_lang::compile;

#[test]
fn optimize_or() -> Result<(), String> {
Expand Down Expand Up @@ -172,10 +170,16 @@ pub fn main(arr1: [(u16, u16, u32); 8]) -> [((u16, u16), u32); 8] {
Ok(())
}

// Run the following test using `cargo test plot --features=plot --release -- --nocapture`

#[test]
#[cfg(feature = "plot")]
fn plot_for_each_join_loop_complexity() -> Result<(), String> {
// change this to 1000 and run this test using `cargo test --release` for a full plot
let max_rows = 40;
use garble_lang::{compile_with_constants, literal::Literal, token::UnsignedNumType};
use plotters::prelude::*;
use std::collections::HashMap;

let max_rows = 1000;

let prg_nested_loop = "
const ROWS_0: usize = PARTY_0::ROWS_0;
Expand Down Expand Up @@ -246,7 +250,7 @@ pub fn main(rows0: [([u8; 8], u32); ROWS_0], rows1: [([u8; 8], u32); ROWS_1]) ->
}
}
}
use plotters::prelude::*;

let root = SVGBackend::new("plot_for_each_join_loop.svg", (1024, 768)).into_drawing_area();
root.fill(&WHITE).unwrap();
let mut chart = ChartBuilder::on(&root)
Expand Down

0 comments on commit 284b8e6

Please sign in to comment.