async-graphql/benchmark/benches/simple.rs

16 lines
511 B
Rust
Raw Normal View History

2020-06-01 16:11:59 +00:00
use criterion::{black_box, criterion_group, criterion_main, Criterion};
2020-09-11 14:55:01 +00:00
use graphql_benchmark::{parse, run, serialize};
2020-06-02 12:57:07 +00:00
use simple::{Q, S};
2020-06-01 16:05:37 +00:00
2020-06-02 12:57:07 +00:00
pub fn bench(c: &mut Criterion) {
c.bench_function("simple run", |b| b.iter(|| run(&S, black_box(Q))));
c.bench_function("simple parse", |b| b.iter(|| parse(black_box(Q))));
2020-09-11 14:55:01 +00:00
let res = run(&S, Q);
2020-06-02 12:57:07 +00:00
c.bench_function("simple serialize", |b| {
b.iter(|| serialize(black_box(&res)))
});
2020-06-01 16:05:37 +00:00
}
2020-06-02 12:57:07 +00:00
criterion_group!(simple, bench);
criterion_main!(simple);