diff --git a/cmd/ledis-dbbench/main.go b/cmd/ledis-dbbench/main.go index b2183ce..0ab8277 100644 --- a/cmd/ledis-dbbench/main.go +++ b/cmd/ledis-dbbench/main.go @@ -58,9 +58,10 @@ func bench(cmd string, f func()) { var kvSetBase int64 = 0 var kvGetBase int64 = 0 +var value []byte + func benchSet() { f := func() { - value := make([]byte, *valueSize) n := atomic.AddInt64(&kvSetBase, 1) db.Set(num.Int64ToBytes(n), value) @@ -122,6 +123,8 @@ func main() { runtime.GOMAXPROCS(runtime.NumCPU()) flag.Parse() + value = make([]byte, *valueSize) + cfg := config.NewConfigDefault() cfg.DataDir = "./var/ledis_dbbench" cfg.DBName = *name