Skip to content

Commit

Permalink
kv: remove btree, and use rbtree to implement membuffer. (pingcap#1043)
Browse files Browse the repository at this point in the history
  • Loading branch information
coocood committed Apr 18, 2016
1 parent b4f41c1 commit e645396
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 1,138 deletions.
142 changes: 0 additions & 142 deletions kv/btree_buffer.go

This file was deleted.

18 changes: 9 additions & 9 deletions kv/mem_buffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type testKVSuite struct {

func (s *testKVSuite) SetUpSuite(c *C) {
s.bs = make([]MemBuffer, 2)
s.bs[0] = NewBTreeBuffer()
s.bs[0] = NewRBTreeBuffer()
s.bs[1] = NewMemDbBuffer()
}

Expand Down Expand Up @@ -207,24 +207,24 @@ func (s *testKVSuite) TestNewIteratorMin(c *C) {

var opCnt = 100000

func BenchmarkBTreeBufferSequential(b *testing.B) {
func BenchmarkRBTreeBufferSequential(b *testing.B) {
data := make([][]byte, opCnt)
for i := 0; i < opCnt; i++ {
data[i] = encodeInt(i)
}
buffer := NewBTreeBuffer()
buffer := NewRBTreeBuffer()
benchmarkSetGet(b, buffer, data)
buffer.Release()
b.ReportAllocs()
}

func BenchmarkBTreeBufferRandom(b *testing.B) {
func BenchmarkRBTreeBufferRandom(b *testing.B) {
data := make([][]byte, opCnt)
for i := 0; i < opCnt; i++ {
data[i] = encodeInt(i)
}
shuffle(data)
buffer := NewBTreeBuffer()
buffer := NewRBTreeBuffer()
benchmarkSetGet(b, buffer, data)
buffer.Release()
b.ReportAllocs()
Expand Down Expand Up @@ -253,8 +253,8 @@ func BenchmarkMemDbBufferRandom(b *testing.B) {
b.ReportAllocs()
}

func BenchmarkBTreeIter(b *testing.B) {
buffer := NewBTreeBuffer()
func BenchmarkRBTreeIter(b *testing.B) {
buffer := NewRBTreeBuffer()
benchIterator(b, buffer)
buffer.Release()
b.ReportAllocs()
Expand All @@ -267,9 +267,9 @@ func BenchmarkMemDbIter(b *testing.B) {
b.ReportAllocs()
}

func BenchmarkBTreeCreation(b *testing.B) {
func BenchmarkRBTreeCreation(b *testing.B) {
for i := 0; i < b.N; i++ {
buffer := NewBTreeBuffer()
buffer := NewRBTreeBuffer()
buffer.Release()
}
b.ReportAllocs()
Expand Down
Loading

0 comments on commit e645396

Please sign in to comment.