mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
chore: improve benchmark for bpptree and zsl tree (#2450)
* chore: improve benchmark for bpptree and zsl tree --------- Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
fab811252b
commit
307bdfdb07
1 changed files with 21 additions and 6 deletions
|
@ -415,9 +415,13 @@ static void BM_FindRandomBPTree(benchmark::State& state) {
|
|||
bptree.Insert(vals[i]);
|
||||
}
|
||||
|
||||
while (state.KeepRunning()) {
|
||||
for (unsigned i = 0; i < iters; ++i) {
|
||||
benchmark::DoNotOptimize(bptree.Contains(vals[i]));
|
||||
unsigned i = 0;
|
||||
while (state.KeepRunningBatch(10)) {
|
||||
for (unsigned j = 0; j < 10; ++j) {
|
||||
benchmark::DoNotOptimize(bptree.GEQ(vals[i]));
|
||||
++i;
|
||||
if (vals.size() == i)
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
for (const auto v : vals) {
|
||||
|
@ -434,9 +438,20 @@ static void BM_FindRandomZSL(benchmark::State& state) {
|
|||
zslInsert(zsl, vals[i].d, sdsdup(vals[i].s));
|
||||
}
|
||||
|
||||
while (state.KeepRunning()) {
|
||||
for (unsigned i = 0; i < iters; ++i) {
|
||||
benchmark::DoNotOptimize(zslGetRank(zsl, vals[i].d, vals[i].s));
|
||||
zrangespec spec;
|
||||
spec.maxex = 0;
|
||||
spec.minex = 0;
|
||||
|
||||
unsigned i = 0;
|
||||
while (state.KeepRunningBatch(10)) {
|
||||
for (unsigned j = 0; j < 10; ++j) {
|
||||
spec.min = vals[i].d;
|
||||
spec.max = spec.min;
|
||||
benchmark::DoNotOptimize(zslFirstInRange(zsl, &spec));
|
||||
|
||||
++i;
|
||||
if (vals.size() == i)
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue