Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-j97 committed Nov 30, 2024
1 parent 915f115 commit 82b3d49
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions benches/memtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn memtable_get_hit(c: &mut Criterion) {

memtable.insert(InternalValue::from_components(
"abc_w5wa35aw35naw",
vec![],
vec![1, 2, 3],
0,
lsm_tree::ValueType::Value,
));
Expand All @@ -23,7 +23,10 @@ fn memtable_get_hit(c: &mut Criterion) {

c.bench_function("memtable get", |b| {
b.iter(|| {
memtable.get("abc_w5wa35aw35naw", None);
assert_eq!(
[1, 2, 3],
&*memtable.get("abc_w5wa35aw35naw", None).unwrap().value,
)
});
});
}
Expand All @@ -39,7 +42,7 @@ fn memtable_get_snapshot(c: &mut Criterion) {
));
memtable.insert(InternalValue::from_components(
"abc_w5wa35aw35naw",
vec![],
vec![1, 2, 3],
1,
lsm_tree::ValueType::Value,
));
Expand All @@ -53,9 +56,12 @@ fn memtable_get_snapshot(c: &mut Criterion) {
));
}

c.bench_function("memtable get", |b| {
c.bench_function("memtable get snapshot", |b| {
b.iter(|| {
memtable.get("abc_w5wa35aw35naw", Some(1));
assert_eq!(
[1, 2, 3],
&*memtable.get("abc_w5wa35aw35naw", Some(1)).unwrap().value,
);
});
});
}
Expand All @@ -72,10 +78,8 @@ fn memtable_get_miss(c: &mut Criterion) {
));
}

c.bench_function("memtable get", |b| {
b.iter(|| {
memtable.get("abc_564321", None);
});
c.bench_function("memtable get miss", |b| {
b.iter(|| assert!(memtable.get("abc_564321", None).is_none()));
});
}

Expand Down

0 comments on commit 82b3d49

Please sign in to comment.