Created
December 2, 2019 22:30
-
-
Save zbraniecki/accb872a0ceb1a8b2e62c48f8ea148c5 to your computer and use it in GitHub Desktop.
Criterion in jsasparagus
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use criterion::criterion_group; | |
use criterion::criterion_main; | |
use criterion::Criterion; | |
fn parse(i: usize) -> bool { | |
i == 3 | |
} | |
fn parser_bench(c: &mut Criterion) { | |
let samples: Vec<usize> = vec![1, 2, 3]; | |
c.bench_function_over_inputs( | |
"parser", | |
move |b, &sample| { | |
b.iter(|| parse(sample)) | |
}, | |
samples, | |
); | |
} | |
criterion_group!(benches, parser_bench); | |
criterion_main!(benches); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "parser" | |
version = "0.1.0" | |
authors = ["Jason Orendorff <[email protected]>"] | |
edition = "2018" | |
[dependencies] | |
generated_parser = { path = "../generated_parser" } | |
ast = { path = "../ast" } | |
bumpalo = "2.6.0" | |
[dev-dependencies] | |
criterion = "0.3" | |
[[bench]] | |
name = "parser" | |
harness = false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment