diff --git a/store/store_test.go b/store/store_test.go index 875750c82..001f5ddd5 100644 --- a/store/store_test.go +++ b/store/store_test.go @@ -150,7 +150,7 @@ func BenchmarkStoreSet(b *testing.B) { func BenchmarkStoreGet(b *testing.B) { s := CreateStore(100) - keys := GenKeys(100, 5) + keys := GenKeys(10000, 5) for i, key := range keys { s.Set(key, "barbarbarbarbar", time.Unix(0, 0), uint64(i)) diff --git a/store/test.go b/store/test.go index a725e87db..ac23261be 100644 --- a/store/test.go +++ b/store/test.go @@ -11,7 +11,7 @@ func GenKeys(num int, depth int) []string { for i := 0; i < num; i++ { keys[i] = "/foo/" - depth := rand.Intn(depth) + depth := rand.Intn(depth) + 1 for j := 0; j < depth; j++ { keys[i] += "/" + strconv.Itoa(rand.Int()) diff --git a/store/tree_store_test.go b/store/tree_store_test.go index 385989e37..99281f3ed 100644 --- a/store/tree_store_test.go +++ b/store/tree_store_test.go @@ -1,7 +1,7 @@ package store import ( - "fmt" + //"fmt" "math/rand" "strconv" "testing" @@ -64,20 +64,20 @@ func TestStoreGet(t *testing.T) { ts.set("/hello/fooo", NewTestNode("barbarbar")) ts.set("/hello/foooo/foo", NewTestNode("barbarbar")) - nodes, keys, ok := ts.list("/hello") + //nodes, keys, ok := ts.list("/hello") - if !ok { - t.Fatalf("cannot list!") - } else { - nodes, _ := nodes.([]*Node) - length := len(nodes) + // if !ok { + // t.Fatalf("cannot list!") + // } else { + // nodes, _ := nodes.([]*Node) + // length := len(nodes) - for i := 0; i < length; i++ { - fmt.Println(keys[i], "=", nodes[i].Value) - } - } + // for i := 0; i < length; i++ { + // fmt.Println(keys[i], "=", nodes[i].Value) + // } + // } - keys = GenKeys(100, 10) + keys := GenKeys(100, 10) for i := 0; i < 100; i++ { value := strconv.Itoa(rand.Int()) @@ -206,15 +206,6 @@ func BenchmarkTreeStoreCopy(b *testing.B) { } } -func BenchmarkMakeSlice(b *testing.B) { - - for i := 0; i < b.N; i++ { - for i := 0; i < 100000; i++ { - _ = make([]Node, 1) - } - } -} - func BenchmarkTreeStoreList(b *testing.B) { keys := GenKeys(10000, 10)