Commit 6793678b authored by Kirill Smelkov's avatar Kirill Smelkov

X fs1: Tune kd so that sizeof(btree data page) is ~= page

name         old time/op    new time/op    delta
IndexLoad-4    2.49ms ± 1%    2.18ms ± 3%  -12.39%  (p=0.000 n=9+10)

name         old alloc/op   new alloc/op   delta
IndexLoad-4    3.77MB ± 0%    3.49MB ± 0%   -7.50%  (p=0.000 n=8+9)

name         old allocs/op  new allocs/op  delta
IndexLoad-4     1.98k ± 0%     0.53k ± 0%  -72.96%  (p=0.000 n=10+10)
parent 1d31475a
...@@ -18,7 +18,7 @@ import ( ...@@ -18,7 +18,7 @@ import (
const ( const (
kx = 32 //TODO benchmark tune this number if using custom key/value type(s). kx = 32 //TODO benchmark tune this number if using custom key/value type(s).
kd = 32 //TODO benchmark tune this number if using custom key/value type(s). kd = 126
//kx = 2 //kx = 2
//kd = 2 //kd = 2
) )
......
#!/bin/sh -e #!/bin/bash -e
# generate b.Tree with compile-time KEY=zodb.Oid, VALUE=int64 and direct oidCmp calls # generate b.Tree with compile-time KEY=zodb.Oid, VALUE=int64, tuned kd and direct oidCmp calls
KEY=zodb.Oid KEY=zodb.Oid
VALUE=int64 VALUE=int64
# adjust kd so that sizeof(d) ~= page
de=16 # KEY+VALUE
o=24 # d.c, d.n, d.p
kd=$(( (4096 - $o - $de) / (2 * $de) ))
b=github.com/cznic/b b=github.com/cznic/b
Bdir=`go list -f '{{.Dir}}' $b` Bdir=`go list -f '{{.Dir}}' $b`
Brev=`cd $Bdir && git describe --always` Brev=`cd $Bdir && git describe --always`
...@@ -18,6 +23,8 @@ make -s -C $Bdir generic |sed \ ...@@ -18,6 +23,8 @@ make -s -C $Bdir generic |sed \
-e 's/package b/package fsb/g' \ -e 's/package b/package fsb/g' \
-e "s/KEY/$KEY/g" \ -e "s/KEY/$KEY/g" \
-e "s/VALUE/$VALUE/g" \ -e "s/VALUE/$VALUE/g" \
\
-e "s/^\(\\s*kd = \).*\$/\\1$kd/g" \
\ \
-e '/cmp *Cmp$/d' \ -e '/cmp *Cmp$/d' \
-e 's/t\.cmp(/oidCmp(/g' \ -e 's/t\.cmp(/oidCmp(/g' \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment