20 lines
497 B
Rust
20 lines
497 B
Rust
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
|
|
|
use departure::response::Response;
|
|
|
|
use std::fs::read_to_string;
|
|
|
|
fn load_json() -> String {
|
|
read_to_string("benches/reply.json").unwrap()
|
|
}
|
|
|
|
fn criterion_benchmark(c: &mut Criterion) {
|
|
let content = load_json();
|
|
c.bench_function("parse JSON", |b| {
|
|
b.iter(|| serde_json::from_str::<'_, Response>(black_box(&content)))
|
|
});
|
|
}
|
|
|
|
criterion_group!(benches, criterion_benchmark);
|
|
criterion_main!(benches);
|