blob: 51e1b13fa58c661c9a574ff646b3a7110a2f311c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use std::fs;
use wmap_renderer::{render_to_surface, Configuration, StageType};
fn benchmark_rendering(c: &mut Criterion) {
let config = Configuration::default();
let example_source = fs::read_to_string("benches/example.wmap").expect("Failed to read benches/example.wmap");
let example_map = wmap_parser::parse(&example_source);
c.bench_function("render example map", |b| {
b.iter(|| render_to_surface(black_box(&example_map), StageType::default(), &config))
});
let huge_source = fs::read_to_string("benches/huge.wmap").expect("Failed to read benches/huge.wmap");
let huge_map = wmap_parser::parse(&huge_source);
c.bench_function("render huge map", |b| {
b.iter(|| render_to_surface(black_box(&huge_map), StageType::default(), &config))
});
}
criterion_group!(benches, benchmark_rendering);
criterion_main!(benches);
|