aboutsummaryrefslogtreecommitdiffstats
path: root/log_db
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-01-18 09:28:37 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-01-18 09:28:37 +0200
commit46942daf0292d2cce4cf5b46b0831ef4ffed0526 (patch)
tree6f36050ebc9b0520bef1543b9678340e1b8bea03 /log_db
parenta012a45c0d2e1791cecec255e7a48dee83e1d8b9 (diff)
Fix benchmark
Diffstat (limited to 'log_db')
-rw-r--r--log_db/benches/benchmark.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/log_db/benches/benchmark.rs b/log_db/benches/benchmark.rs
index dc853b6..148c0b4 100644
--- a/log_db/benches/benchmark.rs
+++ b/log_db/benches/benchmark.rs
@@ -104,17 +104,17 @@ pub fn get_existing_compacted(c: &mut Criterion) {
.expect("Failed to initialize DB");
let mut insts = Vec::new();
+ let mut inst_index = 0;
for size in [100_000, 1_000_000, 10_000_000] {
println!("Prefilling DB to {} entries", size);
prefill_db(&mut db, &mut insts, size, true).expect("Failed to prefill DB");
- let mut inst_it = insts.iter();
group.bench_with_input(BenchmarkId::from_parameter(size), &size, |b, &_size| {
b.iter(|| {
- let result = db
- .get(black_box(&Value::Int(inst_it.next().unwrap().id)))
- .unwrap();
- assert!(result.is_some())
+ let id = insts[inst_index].id;
+ let result = db.get(black_box(&Value::Int(id))).unwrap();
+ assert!(result.is_some());
+ inst_index = (inst_index + 1) % insts.len();
});
});
}