use criterion::{criterion_group, criterion_main, Criterion}; use p3_bn254_fr::Bn254Fr; use p3_field_testing::bench_func::{ benchmark_add_latency, benchmark_add_throughput, benchmark_inv, benchmark_iter_sum, benchmark_sub_latency, benchmark_sub_throughput, }; type F = Bn254Fr; fn bench_field(c: &mut Criterion) { let name = "BN254Fr"; const REPS: usize = 1000; benchmark_inv::(c, name); benchmark_iter_sum::(c, name); benchmark_iter_sum::(c, name); benchmark_iter_sum::(c, name); // Note that each round of throughput has 10 operations // So we should have 10 * more repetitions for latency tests. const L_REPS: usize = 10 * REPS; benchmark_add_latency::(c, name); benchmark_add_throughput::(c, name); benchmark_sub_latency::(c, name); benchmark_sub_throughput::(c, name); } criterion_group!(bn254fr_arithmetic, bench_field); criterion_main!(bn254fr_arithmetic);