Skip to content

Completed a TODO on barrier free SkipList::Insert() and cleaned some unused headers#1309

Open
FlavioMili wants to merge 1 commit intogoogle:mainfrom
FlavioMili:main
Open

Completed a TODO on barrier free SkipList::Insert() and cleaned some unused headers#1309
FlavioMili wants to merge 1 commit intogoogle:mainfrom
FlavioMili:main

Conversation

@FlavioMili
Copy link
Copy Markdown

@FlavioMili FlavioMili commented Mar 21, 2026

I tested the change using perf on previous main version and my branch

perf record -F 999 -g -- ./db_bench_old
mv perf.data perf_old.data

perf record -F 999 -g -- ./db_bench_new
mv perf.data perf_new.data

From the results I got a consistent improvement of up to 10% on the Insert() function.

I needed to add a second function because the other option I had was to use templates with two functions anyway and to me it looked harder to read for a newcomer or maintainer.
There was also the option to add a ternary operator inside the loop but it ended up having no improvement at all, or even being slightly worse.

Environment

  • CPU: 16 * AMD Ryzen AI 7 350 w/ Radeon 860M
  • Cache: 1024 KB
  • Keys/Values: 16B keys / 100B values (1M entries)

Performance Comparison (micros/op)

I would still take these with a grain of salt, some results are too close to be compared in my opinion

| Benchmark | Baseline (Old) | Optimized (New) |
| :--- | :---: | :---: | :---: |
| fillrandom | 1.789 | 1.745 |
| overwrite | 2.474 | 2.419 |
| fill100K | 418753 | 416100 |
| fillsync | 3.591 | 3.570 |
| readrandom | 5.338 | 5.235 |
| readseq | 0.182 | 0.183 |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant