From c4966d7c819afda90c638a7c32b2a398c21d3643 Mon Sep 17 00:00:00 2001 From: cjw Date: Tue, 17 Sep 2024 21:30:40 +0800 Subject: [PATCH] fix: bench (#94) --- benches/benches_against_rocksdb.rs | 37 ++++++++++++++++-------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/benches/benches_against_rocksdb.rs b/benches/benches_against_rocksdb.rs index c069cca..33e41b9 100644 --- a/benches/benches_against_rocksdb.rs +++ b/benches/benches_against_rocksdb.rs @@ -111,24 +111,27 @@ fn bench(c: &mut Criterion, name: &str, build_db: impl Fn(&TempDir) b.iter(|| iterate(db.clone(), KEY_NUMS, CHUNK_SIZE, SMALL_VALUE_SIZE)); }); - c.bench_function("rocks sequentially populate large value", |b| { - let dir = tempfile::Builder::new() - .prefix(&format!("{}-bench-seq-populate-large-value", name)) - .tempdir() - .unwrap(); - let db = build_db(&dir); + c.bench_function( + &format!("{} sequentially populate large value", name), + |b| { + let dir = tempfile::Builder::new() + .prefix(&format!("{}-bench-seq-populate-large-value", name)) + .tempdir() + .unwrap(); + let db = build_db(&dir); - b.iter(|| { - populate( - db.clone(), - KEY_NUMS, - CHUNK_SIZE, - BATCH_SIZE, - LARGE_VALUE_SIZE, - true, - ); - }); - }); + b.iter(|| { + populate( + db.clone(), + KEY_NUMS, + CHUNK_SIZE, + BATCH_SIZE, + LARGE_VALUE_SIZE, + true, + ); + }); + }, + ); c.bench_function(&format!("{} randomly populate large value", name), |b| { let dir = tempfile::Builder::new()