Add criterion crate + basic code

This commit is contained in:
Greg Shuflin 2023-03-10 00:45:04 -08:00
parent 5526ce7bd1
commit d132d8dbdd
2 changed files with 16 additions and 0 deletions

View File

@ -10,4 +10,11 @@ arbitrary = "1.2.0"
proptest = "1.0.0"
[dev-dependencies]
criterion = "0.4.0"
rstest = "0.16.0"
[[bench]]
name = "json-benchmark"
harness = false

View File

@ -0,0 +1,9 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use tests::json_parser::json_object;
pub fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("fib 20", |b| b.iter(|| fibonacci(black_box(20))));
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);