Skip to content

Commit

Permalink
Updated benchmarks after internal API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
geky committed Apr 16, 2023
1 parent 3a470f9 commit 5d68d7e
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 135 deletions.
17 changes: 11 additions & 6 deletions benches/bench_btree.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ defines.LOOKAHEAD_SIZE = 'BLOCK_COUNT / 8'

[cases.bench_btree_lookup]
defines.N = [8, 16, 32, 64, 128, 256, 1024]
defines.VALIDATE = [1, 0]
# 0 = in-order
# 1 = reversed-order
# 2 = random-order
Expand All @@ -31,11 +32,14 @@ code = '''
lfs_off_t i_
= (ORDER == 0) ? i
: (ORDER == 1) ? 0
: BENCH_PRNG(&prng) % (btree.weight+1);
: BENCH_PRNG(&prng) % (lfsr_btree_weight(&btree)+1);
lfsr_btree_push(&lfs, &btree, i_, LFSR_TAG_INLINED, 1,
&alphas[i % 26], 1) => 0;
}
// assume an unfetched btree
btree.root.off = 0;
// bench lookup
BENCH_START();
lfs_size_t i = BENCH_PRNG(&prng) % N;
Expand All @@ -45,8 +49,8 @@ code = '''
lfs_size_t weight_;
lfsr_btree_get(&lfs, &btree, i,
&tag_, &id_, &weight_,
buffer, 4) => 1;
&id_, &tag_, &weight_,
buffer, 4, VALIDATE) => 1;
assert(tag_ == LFSR_TAG_INLINED);
assert(id_ == i);
assert(weight_ == 1);
Expand All @@ -55,6 +59,7 @@ code = '''

[cases.bench_btree_commit]
defines.N = [8, 16, 32, 64, 128, 256, 1024]
defines.VALIDATE = 0
# 0 = in-order
# 1 = reversed-order
# 2 = random-order
Expand Down Expand Up @@ -85,7 +90,7 @@ code = '''
lfs_off_t i_
= (ORDER == 0) ? i
: (ORDER == 1) ? 0
: BENCH_PRNG(&prng) % (btree.weight+1);
: BENCH_PRNG(&prng) % (lfsr_btree_weight(&btree)+1);
lfsr_btree_push(&lfs, &btree, i_, LFSR_TAG_INLINED, 1,
&alphas[i % 26], 1) => 0;
}
Expand All @@ -105,8 +110,8 @@ code = '''
lfs_size_t weight_;
lfsr_btree_get(&lfs, &btree, i,
&tag_, &id_, &weight_,
buffer, 4) => 1;
&id_, &tag_, &weight_,
buffer, 4, VALIDATE) => 1;
assert(tag_ == LFSR_TAG_INLINED);
assert(id_ == i);
assert(weight_ == 1);
Expand Down
Loading

0 comments on commit 5d68d7e

Please sign in to comment.