/// Bench the duration of ReCGen-build from different input samples /// /// to run the bench bin other than 'cargo bench' /// target/release/deps/duration-xxx --bench extern crate recgen; fn criterion_benchmark(c: &mut criterion::Criterion) { let db_fp_string = recgen::utils::get_db_filepath(); let input_dir = recgen::utils::get_inputfile_dir(); let mut group = c.benchmark_group("Sample duration"); // let duration_max: usize = 5 * 36000; // group.measurement_time(std::time::Duration::from_secs(duration_max as u64)); // let durations_estimated: Vec = vec![11, 18 * 60 + 6, 5 * 3600 + 34 * 60 + 47, 1, 28 * 60 + 27]; for idx in 0..5 { let input_filepath = std::path::PathBuf::from(&input_dir).join(format!("sample{}.mol", idx + 1)); group.sample_size(10); group.bench_function(format!("Sample {}", idx + 1), |b| b.iter(|| recgen::build_library_original(db_fp_string.as_str(), input_filepath.to_str().unwrap()))); } } criterion::criterion_group!(benches, criterion_benchmark); criterion::criterion_main!(benches);