adding some benchmarking
This commit is contained in:
parent
eac4dee56d
commit
1b8c353787
27
index/upside_down/benchmark_common_test.go
Normal file
27
index/upside_down/benchmark_common_test.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package upside_down
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/couchbaselabs/bleve/document"
|
||||
"github.com/couchbaselabs/bleve/index/store"
|
||||
)
|
||||
|
||||
func CommonBenchmarkIndex(b *testing.B, s store.KVStore) {
|
||||
|
||||
index := NewUpsideDownCouch(s)
|
||||
|
||||
indexDocument := document.NewDocument("").
|
||||
AddField(document.NewTextField("body", []byte("A boiling liquid expanding vapor explosion (BLEVE, /ˈblɛviː/ blev-ee) is an explosion caused by the rupture of a vessel containing a pressurized liquid above its boiling point.")))
|
||||
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
indexDocument.ID = strconv.Itoa(i)
|
||||
err := index.Update(indexDocument)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
21
index/upside_down/benchmark_forestdb_test.go
Normal file
21
index/upside_down/benchmark_forestdb_test.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
// +build forestdb
|
||||
|
||||
package upside_down
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/couchbaselabs/bleve/index/store/goforestdb"
|
||||
)
|
||||
|
||||
func BenchmarkForestDBIndexing(b *testing.B) {
|
||||
s, err := goforestdb.Open("test")
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
defer os.RemoveAll("test")
|
||||
defer s.Close()
|
||||
|
||||
CommonBenchmarkIndex(b, s)
|
||||
}
|
19
index/upside_down/benchmark_gouchstore_test.go
Normal file
19
index/upside_down/benchmark_gouchstore_test.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package upside_down
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/couchbaselabs/bleve/index/store/gouchstore"
|
||||
)
|
||||
|
||||
func BenchmarkGouchstoreIndexing(b *testing.B) {
|
||||
s, err := gouchstore.Open("test")
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
defer os.RemoveAll("test")
|
||||
defer s.Close()
|
||||
|
||||
CommonBenchmarkIndex(b, s)
|
||||
}
|
19
index/upside_down/benchmark_leveldb_test.go
Normal file
19
index/upside_down/benchmark_leveldb_test.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package upside_down
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/couchbaselabs/bleve/index/store/leveldb"
|
||||
)
|
||||
|
||||
func BenchmarkLevelDBIndexing(b *testing.B) {
|
||||
s, err := leveldb.Open("test")
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
defer os.RemoveAll("test")
|
||||
defer s.Close()
|
||||
|
||||
CommonBenchmarkIndex(b, s)
|
||||
}
|
Loading…
Reference in New Issue
Block a user