Add criterion crate + basic code
This commit is contained in:
parent
5526ce7bd1
commit
d132d8dbdd
@ -10,4 +10,11 @@ arbitrary = "1.2.0"
|
|||||||
proptest = "1.0.0"
|
proptest = "1.0.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
criterion = "0.4.0"
|
||||||
rstest = "0.16.0"
|
rstest = "0.16.0"
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "json-benchmark"
|
||||||
|
harness = false
|
||||||
|
|
||||||
|
|
||||||
|
9
benches/json-benchmark.rs
Normal file
9
benches/json-benchmark.rs
Normal 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);
|
Loading…
Reference in New Issue
Block a user