mirror of
https://github.com/eigenein/wotbreplay-parser.git
synced 2026-10-21 02:17:02 +02:00
✅ Add the benchmark
This commit is contained in:
1 parent
0f437c39de
commit
2d2c85c18a
13 files changed
+46
-20
No files matched your search
@@ -0,0 +1,20 @@
|
||||
use std::fs::File;
|
||||
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use wotbreplay_parser::replay::Replay;
|
||||
|
||||
fn bench_read_data(criterion: &mut Criterion) {
|
||||
let mut group = criterion.benchmark_group("read_data");
|
||||
for path in [
|
||||
"replays/20230429_0126__helaas_pindakaas.wotbreplay",
|
||||
"replays/20230503_0027__helaas_pindakaas.wotbreplay",
|
||||
"replays/20230429_1682194799_malinovka.wotbreplay",
|
||||
] {
|
||||
let mut replay = Replay::open(File::open(path).unwrap()).unwrap();
|
||||
group.bench_function(path, |bencher| bencher.iter(|| replay.read_data().unwrap()));
|
||||
}
|
||||
group.finish();
|
||||
}
|
||||
|
||||
criterion_group!(benches, bench_read_data);
|
||||
criterion_main!(benches);
|
||||
Reference in new issue
Block a user