mirror of https://github.com/ledisdb/ledisdb.git
rename to dbbench using ledis
This commit is contained in:
parent
4a7b57d30e
commit
2d52dca88e
|
@ -5,7 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/siddontang/go/num"
|
"github.com/siddontang/go/num"
|
||||||
"github.com/siddontang/ledisdb/config"
|
"github.com/siddontang/ledisdb/config"
|
||||||
"github.com/siddontang/ledisdb/store"
|
"github.com/siddontang/ledisdb/ledis"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -24,7 +24,8 @@ var round = flag.Int("r", 1, "benchmark round number")
|
||||||
var valueSize = flag.Int("vsize", 100, "kv value size")
|
var valueSize = flag.Int("vsize", 100, "kv value size")
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
var db *store.DB
|
var ldb *ledis.Ledis
|
||||||
|
var db *ledis.DB
|
||||||
|
|
||||||
var loop int = 0
|
var loop int = 0
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ func benchSet() {
|
||||||
value := make([]byte, *valueSize)
|
value := make([]byte, *valueSize)
|
||||||
n := atomic.AddInt64(&kvSetBase, 1)
|
n := atomic.AddInt64(&kvSetBase, 1)
|
||||||
|
|
||||||
db.Put(num.Int64ToBytes(n), value)
|
db.Set(num.Int64ToBytes(n), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
bench("set", f)
|
bench("set", f)
|
||||||
|
@ -104,7 +105,7 @@ func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
cfg := config.NewConfigDefault()
|
cfg := config.NewConfigDefault()
|
||||||
cfg.DBPath = "./var/store_test"
|
cfg.DBPath = "./var/db_test"
|
||||||
cfg.DBName = *name
|
cfg.DBName = *name
|
||||||
os.RemoveAll(cfg.DBPath)
|
os.RemoveAll(cfg.DBPath)
|
||||||
|
|
||||||
|
@ -116,12 +117,14 @@ func main() {
|
||||||
setRocksDB(&cfg.RocksDB)
|
setRocksDB(&cfg.RocksDB)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
db, err = store.Open(cfg)
|
ldb, err = ledis.Open(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db, _ = ldb.Select(0)
|
||||||
|
|
||||||
if *number <= 0 {
|
if *number <= 0 {
|
||||||
panic("invalid number")
|
panic("invalid number")
|
||||||
return
|
return
|
Loading…
Reference in New Issue