diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2024-11-22 10:27:02 +0200 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2024-11-22 10:27:02 +0200 |
| commit | 0e53a1c99ddffcb3d8f58e8942b878ff720684e1 (patch) | |
| tree | 6d5b5fc2d6f418d54dee7b935edc7a459a8f3470 | |
| parent | 0182fd123a1ff6cb08826f824d76693d61fafb1c (diff) | |
Fix benchmark so that it compiles
| -rw-r--r-- | log_db/benches/benchmark.rs | 16 | ||||
| -rw-r--r-- | log_db/benches/utils.rs | 12 |
2 files changed, 11 insertions, 17 deletions
diff --git a/log_db/benches/benchmark.rs b/log_db/benches/benchmark.rs index ee3f81b..c3f7f83 100644 --- a/log_db/benches/benchmark.rs +++ b/log_db/benches/benchmark.rs @@ -23,7 +23,7 @@ pub fn upsert_various_initial_sizes(c: &mut Criterion) { .expect("Failed to convert tmpdir path to str"); let mut db = DB::configure() .data_dir(&data_dir) - .fields(vec![ + .fields(&[ (Field::Id, RecordField::int()), (Field::Name, RecordField::string()), (Field::Data, RecordField::bytes()), @@ -58,7 +58,7 @@ pub fn upsert_various_initial_sizes_compacted(c: &mut Criterion) { let mut db = DB::configure() .data_dir(&data_dir) - .fields(vec![ + .fields(&[ (Field::Id, RecordField::int()), (Field::Name, RecordField::string()), (Field::Data, RecordField::bytes()), @@ -86,11 +86,7 @@ pub fn upsert_various_initial_sizes_compacted(c: &mut Criterion) { pub fn upsert_write_durability(c: &mut Criterion) { let mut group = c.benchmark_group("upsert_write_durability"); - for mode in [ - WriteDurability::Async, - WriteDurability::Flush, - WriteDurability::FlushSync, - ] { + for mode in [WriteDurability::Flush, WriteDurability::FlushSync] { group.bench_with_input(BenchmarkId::from_parameter(&mode), &mode, |b, _mode| { let data_dir_obj = tempfile::tempdir().expect("Failed to get tmpdir"); let data_dir = &data_dir_obj @@ -99,7 +95,7 @@ pub fn upsert_write_durability(c: &mut Criterion) { .expect("Failed to convert tmpdir path to str"); let mut db = DB::configure() .data_dir(&data_dir) - .fields(vec![ + .fields(&[ (Field::Id, RecordField::int()), (Field::Name, RecordField::string()), (Field::Data, RecordField::bytes()), @@ -128,7 +124,7 @@ pub fn get_from_disk_various_initial_sizes(c: &mut Criterion) { .expect("Failed to convert tmpdir path to str"); let mut db = DB::configure() .data_dir(&data_dir) - .fields(vec![ + .fields(&[ (Field::Id, RecordField::int()), (Field::Name, RecordField::string()), (Field::Data, RecordField::bytes()), @@ -158,7 +154,7 @@ pub fn get_from_disk_various_initial_sizes_compacted(c: &mut Criterion) { .expect("Failed to convert tmpdir path to str"); let mut db = DB::configure() .data_dir(&data_dir) - .fields(vec![ + .fields(&[ (Field::Id, RecordField::int()), (Field::Name, RecordField::string()), (Field::Data, RecordField::bytes()), diff --git a/log_db/benches/utils.rs b/log_db/benches/utils.rs index a62162e..afa899a 100644 --- a/log_db/benches/utils.rs +++ b/log_db/benches/utils.rs @@ -24,13 +24,11 @@ pub fn random_bytes(len: usize) -> Vec<u8> { // Function to generate a random record pub fn random_record(from_id: i64, to_id: i64) -> Record { - Record { - values: vec![ - Value::Int(random_int(from_id, to_id)), // Random int value between 0..1000 - Value::String(random_string(5)), // Random string of length 5 - Value::Bytes(random_bytes(10)), // Random bytes of length 10 - ], - } + Record::from(&[ + Value::Int(random_int(from_id, to_id)), // Random int value between 0..1000 + Value::String(random_string(5)), // Random string of length 5 + Value::Bytes(random_bytes(10)), // Random bytes of length 10 + ]) } pub fn prefill_db<T: Eq + Clone + Debug>( |
