aboutsummaryrefslogtreecommitdiff
path: root/db_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-04-10 13:58:21 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-04-10 13:58:21 -0600
commite9c8f14d88c9a25c8bc4b568a9b74b9a65c642f5 (patch)
tree6f6785b4a0470b926ba9315fcc16b00ee9f859c4 /db_test.go
parentMerge pull request #123 from Shopify/commit_in_binary (diff)
parentmake all benchmarks constant size and add multiple sizes (diff)
downloaddedo-e9c8f14d88c9a25c8bc4b568a9b74b9a65c642f5.tar.gz
dedo-e9c8f14d88c9a25c8bc4b568a9b74b9a65c642f5.tar.xz
Merge pull request #122 from mkobetic/benchmark_tweaks
Make all benchmarks constant size and add multiple sizes
Diffstat (limited to 'db_test.go')
-rw-r--r--db_test.go34
1 files changed, 0 insertions, 34 deletions
diff --git a/db_test.go b/db_test.go
index e5b8c1a..10f3220 100644
--- a/db_test.go
+++ b/db_test.go
@@ -5,11 +5,8 @@ import (
"flag"
"fmt"
"io/ioutil"
- "math/rand"
"os"
"regexp"
- "strconv"
- "strings"
"testing"
"time"
"unsafe"
@@ -322,37 +319,6 @@ func TestDBString(t *testing.T) {
assert.Equal(t, db.GoString(), `bolt.DB{path:"/tmp/foo"}`)
}
-// Benchmark the performance of single put transactions in random order.
-func BenchmarkDBPutSequential(b *testing.B) {
- value := []byte(strings.Repeat("0", 64))
- withOpenDB(func(db *DB, path string) {
- db.Update(func(tx *Tx) error {
- return tx.CreateBucket("widgets")
- })
- for i := 0; i < b.N; i++ {
- db.Update(func(tx *Tx) error {
- return tx.Bucket("widgets").Put([]byte(strconv.Itoa(i)), value)
- })
- }
- })
-}
-
-// Benchmark the performance of single put transactions in random order.
-func BenchmarkDBPutRandom(b *testing.B) {
- indexes := rand.Perm(b.N)
- value := []byte(strings.Repeat("0", 64))
- withOpenDB(func(db *DB, path string) {
- db.Update(func(tx *Tx) error {
- return tx.CreateBucket("widgets")
- })
- for i := 0; i < b.N; i++ {
- db.Update(func(tx *Tx) error {
- return tx.Bucket("widgets").Put([]byte(strconv.Itoa(indexes[i])), value)
- })
- }
- })
-}
-
// withTempPath executes a function with a database reference.
func withTempPath(fn func(string)) {
f, _ := ioutil.TempFile("", "bolt-")