diff --git a/triton-vm/Cargo.toml b/triton-vm/Cargo.toml index 0641eab1..b6da79cd 100644 --- a/triton-vm/Cargo.toml +++ b/triton-vm/Cargo.toml @@ -66,6 +66,10 @@ no_profile = [] # see `profiler.rs` for an explanation of this seemingly backwar [lints] workspace = true +[[bench]] +name = "barycentric_eval" +harness = false + [[bench]] name = "bezout_coeffs" harness = false diff --git a/triton-vm/benches/barycentric_eval.rs b/triton-vm/benches/barycentric_eval.rs new file mode 100644 index 00000000..4e116b12 --- /dev/null +++ b/triton-vm/benches/barycentric_eval.rs @@ -0,0 +1,32 @@ +use criterion::criterion_group; +use criterion::criterion_main; +use criterion::BatchSize; +use criterion::Criterion; +use itertools::Itertools; +use rand::prelude::StdRng; +use rand::Rng; +use rand_core::SeedableRng; +use triton_vm::fri::barycentric_evaluate; + +criterion_main!(benches); +criterion_group!( + name = benches; + config = Criterion::default(); + targets = barycentric_eval<11>, + barycentric_eval<13>, + barycentric_eval<15>, + barycentric_eval<17>, + barycentric_eval<19>, + barycentric_eval<21>, +); + +fn barycentric_eval(c: &mut Criterion) { + let mut rng = StdRng::seed_from_u64(13902833756029401496); + c.bench_function(&format!("barycentric_evaluation_(1<<{LOG2_N})"), |b| { + b.iter_batched( + || ((0..1 << LOG2_N).map(|_| rng.gen()).collect_vec(), rng.gen()), + |(codeword, indeterminate)| barycentric_evaluate(&codeword, indeterminate), + BatchSize::SmallInput, + ) + }); +}