diff --git a/compiler/benches/executor_benchmark.rs b/compiler/benches/executor_benchmark.rs index ffa207321..f0d77e9d5 100644 --- a/compiler/benches/executor_benchmark.rs +++ b/compiler/benches/executor_benchmark.rs @@ -5,21 +5,29 @@ use criterion::{criterion_group, criterion_main, Criterion}; use mktemp::Temp; use number::{FieldElement, GoldilocksField}; -use riscv::{compile_rust_crate_to_riscv_asm, compiler}; +use riscv::continuations::bootloader::default_input; +use riscv::{compile_rust_crate_to_riscv_asm, compile_rust_to_riscv_asm, compiler}; use riscv::CoProcessors; type T = GoldilocksField; -fn run_witgen(analyzed: &Analyzed, constants: Vec<(String, Vec)>) { +fn run_witgen( + analyzed: &Analyzed, + constants: Vec<(String, Vec)>, + external_witness_values: Vec<(String, Vec)>, +) { let query_callback = inputs_to_query_callback(vec![]); - executor::witgen::WitnessGenerator::new(analyzed, &constants, query_callback).generate(); + executor::witgen::WitnessGenerator::new(analyzed, &constants, query_callback) + .with_external_witness_values(external_witness_values) + .generate(); } fn criterion_benchmark(c: &mut Criterion) { - let mut group = c.benchmark_group("keccak-executor-benchmark"); + let mut group = c.benchmark_group("executor-benchmark"); group.sample_size(10); + // Keccak let tmp_dir = Temp::new_dir().unwrap(); let riscv_asm_files = compile_rust_crate_to_riscv_asm("../riscv/tests/riscv_data/keccak/Cargo.toml", &tmp_dir); @@ -34,6 +42,26 @@ fn criterion_benchmark(c: &mut Criterion) { run_witgen( &pil_with_constants.pil, pil_with_constants.fixed_cols.clone(), + vec![], + ) + }) + }); + + // The first chunk of `many_chunks`, with Poseidon co-processor & bootloader + let riscv_asm_files = + compile_rust_to_riscv_asm("../riscv/tests/riscv_data/many_chunks.rs", &tmp_dir); + let contents = compiler::compile(riscv_asm_files, &CoProcessors::base().with_poseidon(), true); + let pil_with_constants = Pipeline::::default() + .from_asm_string(contents, None) + .optimized_pil_with_constants() + .unwrap(); + + group.bench_function("many_chunks_chunk_0", |b| { + b.iter(|| { + run_witgen( + &pil_with_constants.pil, + pil_with_constants.fixed_cols.clone(), + vec![("main.bootloader_input_value".to_string(), default_input())], ) }) });