aboutsummaryrefslogtreecommitdiff
path: root/benches/analyzers.rs
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2021-11-18 17:18:37 +0100
committerDaniel Schadt <kingdread@gmx.de>2021-11-18 17:18:37 +0100
commit44a7ff8badf109cf18d3cac29122a8df09966761 (patch)
tree0f516e6732c75a71f2dbe43fcfcaa3948873e3a1 /benches/analyzers.rs
parent7dceef6f8f9e2cc5d3ce57177d2d7ac3abad7a5b (diff)
downloadevtclib-44a7ff8badf109cf18d3cac29122a8df09966761.tar.gz
evtclib-44a7ff8badf109cf18d3cac29122a8df09966761.tar.bz2
evtclib-44a7ff8badf109cf18d3cac29122a8df09966761.zip
add more benchmarks for analyzers
Diffstat (limited to 'benches/analyzers.rs')
-rw-r--r--benches/analyzers.rs61
1 files changed, 61 insertions, 0 deletions
diff --git a/benches/analyzers.rs b/benches/analyzers.rs
new file mode 100644
index 0000000..61aee22
--- /dev/null
+++ b/benches/analyzers.rs
@@ -0,0 +1,61 @@
+use criterion::{black_box, criterion_group, criterion_main, Criterion};
+use evtclib::Compression;
+
+macro_rules! analyzer_benchmark {
+ ($fname:ident, $boss:expr, $log:expr) => {
+ fn $fname(c: &mut Criterion) {
+ let log = evtclib::process_file($log, Compression::Zip).unwrap();
+ let analyzer = log.analyzer().unwrap();
+
+ c.bench_function(&format!("analyzers/{}/is_cm", $boss), |b| {
+ b.iter(|| {
+ black_box(analyzer.is_cm());
+ })
+ });
+
+ c.bench_function(&format!("analyzers/{}/outcome", $boss), |b| {
+ b.iter(|| {
+ black_box(analyzer.outcome());
+ })
+ });
+ }
+ }
+}
+
+macro_rules! benchmarks {
+ ($(($fname:ident, $boss:expr, $log:expr),)*) => {
+ $(analyzer_benchmark!($fname, $boss, $log);)*
+
+ criterion_group! {
+ name = benches;
+ config = Criterion::default();
+ targets = $($fname,)*
+ }
+
+ criterion_main!(benches);
+ }
+}
+
+benchmarks! {
+ (raid_generic, "generic-raid", "tests/logs/vg-20200421.zevtc"),
+ (raid_xera, "xera", "tests/logs/xera-20200415.zevtc"),
+ (raid_cairn, "cairn", "tests/logs/cairn-20200426.zevtc"),
+ (raid_mo, "mo", "tests/logs/mo-20200426.zevtc"),
+ (raid_samarog, "samarog", "tests/logs/samarog-20200426.zevtc"),
+ (raid_deimos, "deimos", "tests/logs/deimos-20200428.zevtc"),
+ (raid_sh, "sh", "tests/logs/desmina-20200425.zevtc"),
+ (raid_river, "river", "tests/logs/river-20210412.zevtc"),
+ (raid_dhuum, "dhuum", "tests/logs/dhuum-20200428.zevtc"),
+ (raid_ca, "ca", "tests/logs/ca-20200426.zevtc"),
+ (raid_largos, "largos", "tests/logs/largos-20200426.zevtc"),
+ (raid_qadim, "qadim", "tests/logs/qadim-20200427.zevtc"),
+ (raid_adina, "adina", "tests/logs/adina-20200427.zevtc"),
+ (raid_sabir, "sabir", "tests/logs/sabir-20200427.zevtc"),
+ (raid_qadimp, "qadimp", "tests/logs/qadimp-20200427.zevtc"),
+
+ (fractal_generic, "generic-fractal", "tests/logs/ensolyss-20200427.zevtc"),
+ (fractal_ai, "ai", "tests/logs/ai-20200922.zevtc"),
+ (fractal_skorvald, "skorvald", "tests/logs/skorvald-20200920.zevtc"),
+
+ (strike_generic, "generic-strike", "tests/logs/whisper-20200424.zevtc"),
+}