aboutsummaryrefslogtreecommitdiffstats
path: root/log_db/benches/benchmark.rs
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-02-05 17:50:02 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-02-09 23:52:26 +0200
commitd422ffe3d48d2061b4d3ddeb0c08796e4d71a5fa (patch)
tree0b6820b060bf0cbeb2686a53a23c9ebee5654334 /log_db/benches/benchmark.rs
parentd4c953dc4bbd190dae4b5be69941f5c42c59af34 (diff)
Remove Recordable trait, implement Python bindings, fixes
Diffstat (limited to 'log_db/benches/benchmark.rs')
-rw-r--r--log_db/benches/benchmark.rs53
1 files changed, 39 insertions, 14 deletions
diff --git a/log_db/benches/benchmark.rs b/log_db/benches/benchmark.rs
index 148c0b4..4c9ad47 100644
--- a/log_db/benches/benchmark.rs
+++ b/log_db/benches/benchmark.rs
@@ -10,12 +10,17 @@ use utils::*;
pub fn upsert_compacted(c: &mut Criterion) {
let mut group = c.benchmark_group("upsert_compacted");
let data_dir_obj = tempfile::tempdir().expect("Failed to get tmpdir");
- let data_dir = &data_dir_obj
+ let data_dir = data_dir_obj
.path()
.to_str()
.expect("Failed to convert tmpdir path to str");
- let mut db = DB::<Inst>::configure()
- .data_dir(&data_dir)
+ let mut db = DB::configure()
+ .schema(Inst::schema())
+ .primary_key(Inst::primary_key())
+ .secondary_keys(Inst::secondary_keys())
+ .from_record(Inst::from_record)
+ .into_record(Inst::into_record)
+ .data_dir(data_dir)
.initialize()
.expect("Failed to initialize DB");
@@ -37,12 +42,17 @@ pub fn upsert_compacted(c: &mut Criterion) {
pub fn delete_existing_compacted(c: &mut Criterion) {
let mut group = c.benchmark_group("delete_existing_compacted");
let data_dir_obj = tempfile::tempdir().expect("Failed to get tmpdir");
- let data_dir = &data_dir_obj
+ let data_dir = data_dir_obj
.path()
.to_str()
.expect("Failed to convert tmpdir path to str");
- let mut db = DB::<Inst>::configure()
- .data_dir(&data_dir)
+ let mut db = DB::configure()
+ .schema(Inst::schema())
+ .primary_key(Inst::primary_key())
+ .secondary_keys(Inst::secondary_keys())
+ .from_record(Inst::from_record)
+ .into_record(Inst::into_record)
+ .data_dir(data_dir)
.initialize()
.expect("Failed to initialize DB");
@@ -71,12 +81,17 @@ pub fn upsert_write_durability(c: &mut Criterion) {
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
+ let data_dir = data_dir_obj
.path()
.to_str()
.expect("Failed to convert tmpdir path to str");
- let mut db = DB::<Inst>::configure()
- .data_dir(&data_dir)
+ let mut db = DB::configure()
+ .schema(Inst::schema())
+ .primary_key(Inst::primary_key())
+ .secondary_keys(Inst::secondary_keys())
+ .from_record(Inst::from_record)
+ .into_record(Inst::into_record)
+ .data_dir(data_dir)
.write_durability(mode.clone())
.initialize()
.expect("Failed to initialize DB");
@@ -94,12 +109,17 @@ pub fn get_existing_compacted(c: &mut Criterion) {
let mut group = c.benchmark_group("get_existing_compacted");
let data_dir_obj = tempfile::tempdir().expect("Failed to get tmpdir");
- let data_dir = &data_dir_obj
+ let data_dir = data_dir_obj
.path()
.to_str()
.expect("Failed to convert tmpdir path to str");
- let mut db = DB::<Inst>::configure()
- .data_dir(&data_dir)
+ let mut db = DB::configure()
+ .schema(Inst::schema())
+ .primary_key(Inst::primary_key())
+ .secondary_keys(Inst::secondary_keys())
+ .from_record(Inst::from_record)
+ .into_record(Inst::into_record)
+ .data_dir(data_dir)
.initialize()
.expect("Failed to initialize DB");
@@ -129,8 +149,13 @@ pub fn find_by_existing_compacted(c: &mut Criterion) {
let data_dir = data_dir_path
.to_str()
.expect("Failed to convert tmpdir path to str");
- let mut db = DB::<Inst>::configure()
- .data_dir(&data_dir)
+ let mut db = DB::configure()
+ .schema(Inst::schema())
+ .primary_key(Inst::primary_key())
+ .secondary_keys(Inst::secondary_keys())
+ .from_record(Inst::from_record)
+ .into_record(Inst::into_record)
+ .data_dir(data_dir)
.initialize()
.expect("Failed to initialize DB");