Commit be48a068 authored by Jan Mercl's avatar Jan Mercl

Minor tweaks

parent 79a6095c
......@@ -512,7 +512,7 @@ func BenchmarkDelRnd(b *testing.B) {
}
func TestDelete2(t *testing.T) {
const N = 100000
const N = 80000
for _, x := range []int{0, -1, 0x55555555, 0xaaaaaaaa, 314159265} {
r := TreeNew(cmp)
set := r.Set
......@@ -563,7 +563,7 @@ func TestEnumeratorNext(t *testing.T) {
r.Set(30, 300)
for verChange := 0; verChange < 16; verChange++ {
t.Logf("Seek %d", test.k)
//t.Logf("Seek %d", test.k)
en, hit := r.Seek(test.k)
if g, e := hit, test.hit; g != e {
......@@ -573,7 +573,7 @@ func TestEnumeratorNext(t *testing.T) {
j := 0
for {
if verChange&(1<<uint(j)) != 0 {
t.Log("version change")
//t.Log("version change")
r.Set(20, 200)
}
......@@ -586,7 +586,7 @@ func TestEnumeratorNext(t *testing.T) {
break
}
t.Logf("Next -> %v: %v", k, v)
//t.Logf("Next -> %v: %v", k, v)
if j >= len(up) {
t.Fatal(i, j, verChange)
}
......@@ -636,7 +636,7 @@ func TestEnumeratorPrev(t *testing.T) {
r.Set(30, 300)
for verChange := 0; verChange < 16; verChange++ {
t.Logf("Seek %d", test.k)
//t.Logf("Seek %d", test.k)
en, hit := r.Seek(test.k)
if g, e := hit, test.hit; g != e {
......@@ -646,7 +646,7 @@ func TestEnumeratorPrev(t *testing.T) {
j := 0
for {
if verChange&(1<<uint(j)) != 0 {
t.Log("version change")
//t.Log("version change")
r.Set(20, 200)
}
......@@ -659,7 +659,7 @@ func TestEnumeratorPrev(t *testing.T) {
break
}
t.Logf("Prev -> %v: %v", k, v)
//t.Logf("Prev -> %v: %v", k, v)
if j >= len(dn) {
t.Fatal(i, j, verChange)
}
......
......@@ -13,10 +13,10 @@
// $ make generic
//
// Performing it will write to stdout a version of the btree.go file where
// every key type occurrence is replaced by the word KEY and every value type
// occurrence is replaced by the word VALUE. In both cases as seen here, ie.
// all upper case letters. Then you have to replace the strings {KEY,VALUE}
// with your desired type(s), using any technique you're comfortable with.
// every key type occurrence is replaced by the word 'key' (written in all
// CAPS) and every value type occurrence is replaced by the word 'value'
// (written in all CAPS). Then you have to replace theses strings with your
// desired type(s), using any technique you're comfortable with.
package b
import (
......@@ -26,8 +26,8 @@ import (
//TODO check vs orig initialize/finalize
const (
kx = 128 //TODO benchmark tune this number if key type is not interface{}
kd = 64 //TODO benchmark tune this number if value type is not interface{}
kx = 128 //TODO benchmark tune this number if using custom key/value type(s).
kd = 64 //TODO benchmark tune this number if using custom key/value type(s).
)
type (
......@@ -473,7 +473,6 @@ func (t *Tree) SeekLast() (e *Enumerator, err error) {
// Set sets the value associated with k.
func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
t.ver++
pi := -1
var p *x
q := t.r
......@@ -505,6 +504,7 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
default:
t.overflow(p, x, pi, i, k, v)
}
t.ver++
return
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment