summaryrefslogtreecommitdiff
path: root/libgo/go/bytes/bytes_test.go
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-03 21:58:02 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-03 21:58:02 +0000
commit0694cef2844753fb80be4f71f7d2eb82eb5ba464 (patch)
tree2f8da9862a9c1fe0df138917f997b03439c02773 /libgo/go/bytes/bytes_test.go
parent397fecd695789eccab667bf771a354df71d843e8 (diff)
downloadgcc-0694cef2844753fb80be4f71f7d2eb82eb5ba464.tar.gz
libgo: Update to go1.6rc1.
Reviewed-on: https://go-review.googlesource.com/19200 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233110 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/bytes/bytes_test.go')
-rw-r--r--libgo/go/bytes/bytes_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/libgo/go/bytes/bytes_test.go b/libgo/go/bytes/bytes_test.go
index 6245e481805..8df62fcc6ae 100644
--- a/libgo/go/bytes/bytes_test.go
+++ b/libgo/go/bytes/bytes_test.go
@@ -1255,3 +1255,34 @@ func BenchmarkRepeat(b *testing.B) {
Repeat([]byte("-"), 80)
}
}
+
+func benchmarkBytesCompare(b *testing.B, n int) {
+ var x = make([]byte, n)
+ var y = make([]byte, n)
+
+ for i := 0; i < n; i++ {
+ x[i] = 'a'
+ }
+
+ for i := 0; i < n; i++ {
+ y[i] = 'a'
+ }
+
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ Compare(x, y)
+ }
+}
+
+func BenchmarkBytesCompare1(b *testing.B) { benchmarkBytesCompare(b, 1) }
+func BenchmarkBytesCompare2(b *testing.B) { benchmarkBytesCompare(b, 2) }
+func BenchmarkBytesCompare4(b *testing.B) { benchmarkBytesCompare(b, 4) }
+func BenchmarkBytesCompare8(b *testing.B) { benchmarkBytesCompare(b, 8) }
+func BenchmarkBytesCompare16(b *testing.B) { benchmarkBytesCompare(b, 16) }
+func BenchmarkBytesCompare32(b *testing.B) { benchmarkBytesCompare(b, 32) }
+func BenchmarkBytesCompare64(b *testing.B) { benchmarkBytesCompare(b, 64) }
+func BenchmarkBytesCompare128(b *testing.B) { benchmarkBytesCompare(b, 128) }
+func BenchmarkBytesCompare256(b *testing.B) { benchmarkBytesCompare(b, 256) }
+func BenchmarkBytesCompare512(b *testing.B) { benchmarkBytesCompare(b, 512) }
+func BenchmarkBytesCompare1024(b *testing.B) { benchmarkBytesCompare(b, 1024) }
+func BenchmarkBytesCompare2048(b *testing.B) { benchmarkBytesCompare(b, 2048) }