diff options
| author | Roger Peppe <rogpeppe@gmail.com> | 2011-12-20 09:25:47 -0800 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2011-12-20 09:25:47 -0800 |
| commit | 16bf7d9e82fd043ed44b3cb0ebd106c397f326d2 (patch) | |
| tree | 6553d94afe71332771a6c853df87dd08ea2bc1f7 /src/pkg/encoding/binary/varint_test.go | |
| parent | 317ad14c6a963b9bb6f81050254026061082a3e8 (diff) | |
| download | go-16bf7d9e82fd043ed44b3cb0ebd106c397f326d2.tar.xz | |
encoding/binary: add more benchmarks
Also add a byte count to the varint benchmarks - this
isn't accurate, of course, but it allows a rough comparison to
the other benchmarks.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5496070
Diffstat (limited to 'src/pkg/encoding/binary/varint_test.go')
| -rw-r--r-- | src/pkg/encoding/binary/varint_test.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/pkg/encoding/binary/varint_test.go b/src/pkg/encoding/binary/varint_test.go index b553d6d4eb..dc550f22f4 100644 --- a/src/pkg/encoding/binary/varint_test.go +++ b/src/pkg/encoding/binary/varint_test.go @@ -165,6 +165,7 @@ func TestNonCanonicalZero(t *testing.T) { func BenchmarkPutUvarint32(b *testing.B) { buf := make([]byte, MaxVarintLen32) + b.SetBytes(4) for i := 0; i < b.N; i++ { for j := uint(0); j < MaxVarintLen32; j++ { PutUvarint(buf, 1<<(j*7)) @@ -174,6 +175,7 @@ func BenchmarkPutUvarint32(b *testing.B) { func BenchmarkPutUvarint64(b *testing.B) { buf := make([]byte, MaxVarintLen64) + b.SetBytes(8) for i := 0; i < b.N; i++ { for j := uint(0); j < MaxVarintLen64; j++ { PutUvarint(buf, 1<<(j*7)) |
