shark/fish/benches/evaluation.rs

72 lines
1.5 KiB
Rust
Raw Normal View History

use criterion::{BenchmarkId, Criterion};
use mino::{mat, Mat};
pub static MATRIX: &[&Mat] = &[
mat! {
"xxxxxxxx.x";
"xxxxxxx.xx";
"xxxx.xxxxx";
".xxxxxxxxx";
"xxxxx.xxxx";
"xxxx.xxxxx";
"xxxxxx.xxx";
".xxxxxxxxx";
"xxxxx.xxxx";
},
mat! {
"..OOSLL...";
".ZOOSSLI..";
"ZZZJJSLI..";
"xxxxxxxxx.";
"xxxxxxxx.x";
"xxxxxxxxx.";
"xxxxxx.xxx";
"xxxxxxx.xx";
"xxxxxx.xxx";
},
mat! {
"....T.....";
"...TTTSS..";
".....SS...";
"xxxxxxxx.x";
"xx.xxxxxxx";
".xxxxxxxxx";
"xxxxxxx.xx";
"x.xxxxxxxx";
"xxxxxxx.xx";
"xxxxxxxxx.";
"xxxxxxx.xx";
"x.xxxxxxxx";
},
mat! {
"I.........";
"I.........";
"I...T.....";
"IZ.TTTSSJJ";
"ZZLLLSS.J.";
"xxxxxxx.xx";
"x.xxxxxxxx";
"xxxxxxx.xx";
"xxxxxxxxx.";
"xxxxxxx.xx";
"x.xxxxxxxx";
"xxxxxx.xxx";
".xxxxxxxxx";
"xxxx.xxxxx";
},
];
fn benchmark_mdse(c: &mut Criterion) {
let mut c = c.benchmark_group("eval");
c.confidence_level(0.98);
for (i, &matrix) in MATRIX.iter().enumerate() {
c.bench_with_input(BenchmarkId::new("mystery_mdse", i), matrix, |b, matrix| {
b.iter(|| fish::eval::mystery_mdse(matrix))
});
}
c.finish();
}
criterion::criterion_group!(benches, benchmark_mdse);
criterion::criterion_main!(benches);