bmatsuo / lmdb-go

Bindings for the LMDB C library
BSD 3-Clause "New" or "Revised" License
157 stars 59 forks source link

Bmatsuo/reader list context fix #14

Closed bmatsuo closed 8 years ago

bmatsuo commented 8 years ago

Relates to #10.

Stops passing a struct containing a function pointer through a C function. The function pointer is stored in a map along with any error returned by the msgfunc.

A simple benchmark was added for Env.ReaderList to gauge performance previously and with the given changes. One hundred readers are listed on an empty environment:

before:

PASS
BenchmarkEnv_ReaderList-4      20000         73322 ns/op
ok      github.com/bmatsuo/lmdb-go/lmdb 2.756s

after:

PASS
BenchmarkEnv_ReaderList-4      20000         72888 ns/op
ok      github.com/bmatsuo/lmdb-go/lmdb 2.701s

benchcmp:

benchmark                     old ns/op     new ns/op     delta
BenchmarkEnv_ReaderList-4     73322         72888         -0.59%