mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-19 23:15:28 +01:00
Add some more micro-benchmarks
This commit is contained in:
@@ -33,6 +33,33 @@ fn bench(c: &mut Criterion) {
|
||||
})
|
||||
});
|
||||
|
||||
let clock = LocalClock::default();
|
||||
let db = Database::new(clock);
|
||||
group.bench_function("begin_tx-read-commit_tx", |b| {
|
||||
b.iter(|| {
|
||||
let tx_id = db.begin_tx();
|
||||
db.read(tx_id, 1).unwrap();
|
||||
db.commit_tx(tx_id)
|
||||
})
|
||||
});
|
||||
|
||||
let clock = LocalClock::default();
|
||||
let db = Database::new(clock);
|
||||
group.bench_function("begin_tx-update-commit_tx", |b| {
|
||||
b.iter(|| {
|
||||
let tx_id = db.begin_tx();
|
||||
db.update(
|
||||
tx_id,
|
||||
Row {
|
||||
id: 1,
|
||||
data: "World".to_string(),
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
db.commit_tx(tx_id)
|
||||
})
|
||||
});
|
||||
|
||||
let clock = LocalClock::default();
|
||||
let db = Database::new(clock);
|
||||
let tx = db.begin_tx();
|
||||
@@ -49,6 +76,30 @@ fn bench(c: &mut Criterion) {
|
||||
db.read(tx, 1).unwrap();
|
||||
})
|
||||
});
|
||||
|
||||
let clock = LocalClock::default();
|
||||
let db = Database::new(clock);
|
||||
let tx = db.begin_tx();
|
||||
db.insert(
|
||||
tx,
|
||||
Row {
|
||||
id: 1,
|
||||
data: "Hello".to_string(),
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
group.bench_function("update", |b| {
|
||||
b.iter(|| {
|
||||
db.update(
|
||||
tx,
|
||||
Row {
|
||||
id: 1,
|
||||
data: "World".to_string(),
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group! {
|
||||
|
||||
Reference in New Issue
Block a user