rust-parser-combinator/benches/json-benchmark.rs
2023-03-10 01:16:06 -08:00

15 lines
448 B
Rust

use criterion::{black_box, criterion_group, criterion_main, Criterion};
use parser_combinator::testutil::json_object;
use parser_combinator::Parser;
pub fn criterion_benchmark(c: &mut Criterion) {
let test_json = include_str!("../tests/joplin-cfg.json");
c.bench_function("parse_json", |b| {
b.iter(|| json_object().parse(black_box(test_json)))
});
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);