mirror of
https://github.com/kristoferssolo/project-finder.git
synced 2025-10-21 19:50:35 +00:00
44 lines
1.0 KiB
Rust
44 lines
1.0 KiB
Rust
use crate::common::{
|
|
default,
|
|
setup::{BenchParams, TEMP_DIR, init_temp_dir},
|
|
utils::run_binary_with_args,
|
|
};
|
|
use criterion::{BenchmarkId, Criterion};
|
|
|
|
pub fn benchmark_basic(c: &mut Criterion) {
|
|
init_temp_dir();
|
|
let temp_dir = TEMP_DIR.get().unwrap().path();
|
|
|
|
let params = vec![
|
|
BenchParams {
|
|
depth: Some(1),
|
|
..Default::default()
|
|
},
|
|
BenchParams {
|
|
depth: Some(5),
|
|
..default()
|
|
},
|
|
BenchParams {
|
|
depth: Some(10),
|
|
..default()
|
|
},
|
|
BenchParams {
|
|
depth: Some(10),
|
|
max_results: Some(10),
|
|
..default()
|
|
},
|
|
];
|
|
|
|
let mut group = c.benchmark_group("basic_scenarios");
|
|
|
|
for (idx, param) in params.iter().enumerate() {
|
|
let id = BenchmarkId::new(format!("with_param_{idx}"), ¶m);
|
|
|
|
group.bench_with_input(id, ¶m, |b, param| {
|
|
b.iter(|| run_binary_with_args(temp_dir, param).expect("Failed to run binary"))
|
|
});
|
|
}
|
|
|
|
group.finish();
|
|
}
|