diff options
author | Ian Lance Taylor <iant@google.com> | 2016-02-03 21:58:02 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-02-03 21:58:02 +0000 |
commit | f98dd1a338867a408f7c72d73fbad7fe7fc93e3a (patch) | |
tree | 2f8da9862a9c1fe0df138917f997b03439c02773 /libgo/go/bytes/bytes_test.go | |
parent | b081ed4efc144da0c45a6484aebfd10e0eb9fda3 (diff) | |
download | gcc-f98dd1a338867a408f7c72d73fbad7fe7fc93e3a.tar.gz |
libgo: Update to go1.6rc1.
Reviewed-on: https://go-review.googlesource.com/19200
From-SVN: r233110
Diffstat (limited to 'libgo/go/bytes/bytes_test.go')
-rw-r--r-- | libgo/go/bytes/bytes_test.go | 31 |
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) } |