goleveldb icon indicating copy to clipboard operation
goleveldb copied to clipboard

memdb: merge nodeData and kvData to speedup access

Open qianbin opened this issue 2 years ago • 0 comments

This PR makes memdb save skiplist nodes and kvs together in one byte-slice. The performance of memdb is significantly improved with this change(it's believed that the CPU cache hit-rate goes up).

benchmarks:

$ benchstat before.txt after.txt 
name         old time/op  new time/op  delta
Put-8        1.08µs ± 1%  0.98µs ± 1%   -9.11%  (p=0.008 n=5+5)
PutRandom-8  1.86µs ± 1%  1.52µs ± 2%  -17.94%  (p=0.008 n=5+5)
Get-8        1.24µs ± 1%  1.12µs ± 1%  -10.26%  (p=0.008 n=5+5)
GetRandom-8  2.06µs ± 1%  1.67µs ± 1%  -19.01%  (p=0.008 n=5+5)

qianbin avatar Jul 28 '22 03:07 qianbin