travis: deprecate go1.2 and go1.3; add go1.5 and go1.6
diff --git a/.travis.yml b/.travis.yml
index 1428e77..5f26f3f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,9 @@
language: go
go:
- - 1.2
- - 1.3
- 1.4
+ - 1.5
+ - 1.6
- tip
script:
diff --git a/README.md b/README.md
index d838b0c..259286f 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@
Requirements
-----------
-* Need at least `go1.2` or newer.
+* Need at least `go1.4` or newer.
Usage
-----------
diff --git a/leveldb/bench2_test.go b/leveldb/bench2_test.go
deleted file mode 100644
index 0dd60fd..0000000
--- a/leveldb/bench2_test.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2012, Suryandaru Triandana <syndtr@gmail.com>
-// All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// +build !go1.2
-
-package leveldb
-
-import (
- "sync/atomic"
- "testing"
-)
-
-func BenchmarkDBReadConcurrent(b *testing.B) {
- p := openDBBench(b, false)
- p.populate(b.N)
- p.fill()
- p.gc()
- defer p.close()
-
- b.ResetTimer()
- b.SetBytes(116)
-
- b.RunParallel(func(pb *testing.PB) {
- iter := p.newIter()
- defer iter.Release()
- for pb.Next() && iter.Next() {
- }
- })
-}
-
-func BenchmarkDBReadConcurrent2(b *testing.B) {
- p := openDBBench(b, false)
- p.populate(b.N)
- p.fill()
- p.gc()
- defer p.close()
-
- b.ResetTimer()
- b.SetBytes(116)
-
- var dir uint32
- b.RunParallel(func(pb *testing.PB) {
- iter := p.newIter()
- defer iter.Release()
- if atomic.AddUint32(&dir, 1)%2 == 0 {
- for pb.Next() && iter.Next() {
- }
- } else {
- if pb.Next() && iter.Last() {
- for pb.Next() && iter.Prev() {
- }
- }
- }
- })
-}
diff --git a/leveldb/bench_test.go b/leveldb/bench_test.go
index 5c587b9..12a8496 100644
--- a/leveldb/bench_test.go
+++ b/leveldb/bench_test.go
@@ -13,6 +13,7 @@
"os"
"path/filepath"
"runtime"
+ "sync/atomic"
"testing"
"github.com/syndtr/goleveldb/leveldb/iterator"
@@ -462,3 +463,47 @@
p.gets()
p.close()
}
+
+func BenchmarkDBReadConcurrent(b *testing.B) {
+ p := openDBBench(b, false)
+ p.populate(b.N)
+ p.fill()
+ p.gc()
+ defer p.close()
+
+ b.ResetTimer()
+ b.SetBytes(116)
+
+ b.RunParallel(func(pb *testing.PB) {
+ iter := p.newIter()
+ defer iter.Release()
+ for pb.Next() && iter.Next() {
+ }
+ })
+}
+
+func BenchmarkDBReadConcurrent2(b *testing.B) {
+ p := openDBBench(b, false)
+ p.populate(b.N)
+ p.fill()
+ p.gc()
+ defer p.close()
+
+ b.ResetTimer()
+ b.SetBytes(116)
+
+ var dir uint32
+ b.RunParallel(func(pb *testing.PB) {
+ iter := p.newIter()
+ defer iter.Release()
+ if atomic.AddUint32(&dir, 1)%2 == 0 {
+ for pb.Next() && iter.Next() {
+ }
+ } else {
+ if pb.Next() && iter.Last() {
+ for pb.Next() && iter.Prev() {
+ }
+ }
+ }
+ })
+}
diff --git a/leveldb/cache/bench2_test.go b/leveldb/cache/bench_test.go
similarity index 96%
rename from leveldb/cache/bench2_test.go
rename to leveldb/cache/bench_test.go
index 175e222..89aef69 100644
--- a/leveldb/cache/bench2_test.go
+++ b/leveldb/cache/bench_test.go
@@ -4,13 +4,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// +build !go1.2
-
package cache
import (
"math/rand"
"testing"
+ "time"
)
func BenchmarkLRUCache(b *testing.B) {