-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
use tempfile::tempdir; | ||
use tokio::runtime; | ||
use velarixdb::db::DataStore; | ||
|
||
// Not sure if this is the best way to implement benchmark for async ops but | ||
// for now it LGTM (logically), review is accepted! | ||
fn insert_many(c: &mut Criterion) { | ||
let root = tempdir().unwrap(); | ||
let path = root.path().join("default"); | ||
let rt = runtime::Runtime::new().unwrap(); | ||
let mut store = { rt.block_on(async { DataStore::open("benchmark", path).await.unwrap() }) }; | ||
c.bench_function("insert_many", |b| { | ||
b.iter(|| { | ||
rt.block_on(async { | ||
for e in 1..=3000 { | ||
let e = e.to_string(); | ||
store.put(&e, &e).await.unwrap(); | ||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
|
||
|
||
|
||
criterion_group!(benches, insert_many); | ||
criterion_main!(benches); |
Binary file modified
BIN
+18 Bytes
(100%)
.../data/buckets/bucket1201eb6b-8903-4557-a5bd-d87cb725f1d8/sstable_1720785462309/summary.db
Binary file not shown.