diff --git a/vbtkey/vbtkey.go b/vbtkey/vbtkey.go index 6657693..feb4e6e 100644 --- a/vbtkey/vbtkey.go +++ b/vbtkey/vbtkey.go @@ -1,8 +1,6 @@ package avlindex import ( - "log" - "github.com/davecgh/go-spew/spew" "github.com/emirpasic/gods/utils" @@ -602,7 +600,6 @@ func (tree *Tree) Traversal(every func(v interface{}) bool, traversalMethod ...i return true } if !traverasl(cur.children[0]) { - log.Println(cur) return false } if !every(cur.value) { diff --git a/vbtkey/vbtkey_test.go b/vbtkey/vbtkey_test.go index c16ab84..1d2bcfc 100644 --- a/vbtkey/vbtkey_test.go +++ b/vbtkey/vbtkey_test.go @@ -552,7 +552,7 @@ func BenchmarkGet(b *testing.B) { b.ResetTimer() b.StartTimer() - execCount := 50 + execCount := 10 b.N = len(l) * execCount for i := 0; i < execCount; i++ { @@ -574,7 +574,7 @@ func BenchmarkGodsRBGet(b *testing.B) { b.ResetTimer() b.StartTimer() - execCount := 50 + execCount := 10 b.N = len(l) * execCount for i := 0; i < execCount; i++ { @@ -596,7 +596,7 @@ func BenchmarkGodsAvlGet(b *testing.B) { b.ResetTimer() b.StartTimer() - execCount := 50 + execCount := 10 b.N = len(l) * execCount for i := 0; i < execCount; i++ { @@ -612,7 +612,7 @@ func BenchmarkPut(b *testing.B) { b.ResetTimer() b.StartTimer() - execCount := 1 + execCount := 10 b.N = len(l) * execCount for i := 0; i < execCount; i++ { tree := New(utils.IntComparator) @@ -625,47 +625,47 @@ func BenchmarkPut(b *testing.B) { func TestPutStable(t *testing.T) { // l := []int{14, 18, 20, 21, 22, 23, 19} - for n := 0; n < 1000000; n++ { - var l []int - l = append(l, 60, 5, 15) - for i := 0; len(l) < 11; i++ { - l = append(l, randomdata.Number(3, 69)) - } + // for n := 0; n < 1000000; n++ { + // var l []int + // l = append(l, 60, 5, 15) + // for i := 0; len(l) < 11; i++ { + // l = append(l, randomdata.Number(3, 69)) + // } - tree := New(utils.IntComparator) - for _, v := range l { - tree.Put(v, v) - } - result := tree.getArountNode(60) + // tree := New(utils.IntComparator) + // for _, v := range l { + // tree.Put(v, v) + // } + // result := tree.getArountNode(60) - if result[2] == nil && tree.indexNode(-1) != result[1] { - t.Error(tree.debugString()) - t.Error(tree.Values()) - t.Error(result) - } + // if result[2] == nil && tree.indexNode(-1) != result[1] { + // t.Error(tree.debugString()) + // t.Error(tree.Values()) + // t.Error(result) + // } - result = tree.getArountNode(5) - if result[0] == nil && tree.indexNode(0) != result[1] { - t.Error(tree.debugString()) - t.Error(tree.Values()) - t.Error(result) - } + // result = tree.getArountNode(5) + // if result[0] == nil && tree.indexNode(0) != result[1] { + // t.Error(tree.debugString()) + // t.Error(tree.Values()) + // t.Error(result) + // } - result = tree.getArountNode(2) - if result[2] == nil && tree.indexNode(0) != result[2] { - t.Error(tree.debugString()) - t.Error(tree.Values()) - t.Error(result) - } + // result = tree.getArountNode(2) + // if result[2] == nil && tree.indexNode(0) != result[2] { + // t.Error(tree.debugString()) + // t.Error(tree.Values()) + // t.Error(result) + // } - result = tree.getArountNode(70) - if result[0] == nil && tree.indexNode(-1) != result[0] { - t.Error(tree.debugString()) - t.Error(tree.Values()) - t.Error(result) - } + // result = tree.getArountNode(70) + // if result[0] == nil && tree.indexNode(-1) != result[0] { + // t.Error(tree.debugString()) + // t.Error(tree.Values()) + // t.Error(result) + // } - } + // } // for _, v := range []int{10, 0, 9, 5, -11, -10, -1, -5} { // t.Error(tree.Index(v)) // // t.Error(tree.debugString()) @@ -720,7 +720,7 @@ func BenchmarkTraversal(b *testing.B) { b.ResetTimer() b.StartTimer() - execCount := 50 + execCount := 10 b.N = len(l) * execCount for n := 0; n < execCount; n++ {