#[cfg(feature = "bench")]
#[cfg(test)]
mod bench_tests {
use crate::compile::compile_and_write;
use benchmarks::{GlobalRecorder, Provider, CIRCUITS};
#[test]
#[ignore]
fn bench_compiler() {
let output_dir = std::env::var("UNIT_BENCH_OUTPUT_DIR").unwrap_or("/tmp".to_string());
GlobalRecorder::init(Provider::Compiler);
for circuit in CIRCUITS {
let base_path = circuit.base_path();
let start = std::time::Instant::now();
compile_and_write(base_path.to_str().unwrap()).unwrap();
let elapsed = start.elapsed();
GlobalRecorder::record_circuit_ns(*circuit, "all".to_string(), elapsed.as_nanos());
println!("[{}] all: {:.2?}", circuit.folder_name(), elapsed,);
}
GlobalRecorder::save(&output_dir);
println!("Results saved to {output_dir}");
}
}