diff options
| author | Josh Bleecher Snyder <josharian@gmail.com> | 2017-06-09 11:28:42 -0700 |
|---|---|---|
| committer | Josh Bleecher Snyder <josharian@gmail.com> | 2017-08-14 00:50:52 +0000 |
| commit | 38044eca7c67981aa0c98847a35ec2daf0763d0e (patch) | |
| tree | 5e455cc50457a1b0b088c5b3bf033a67fb984250 /src/runtime/map_test.go | |
| parent | 9065c3bf3464f6a94e2b60992a9cba76effc16bc (diff) | |
| download | go-38044eca7c67981aa0c98847a35ec2daf0763d0e.tar.xz | |
runtime: make map deletion benchmarks faster to run
This reduces the wall time to run these benchmarks by about 30%.
Change-Id: I494a93c93e5acb1514510d85f65796f62e1629a5
Reviewed-on: https://go-review.googlesource.com/54650
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Diffstat (limited to 'src/runtime/map_test.go')
| -rw-r--r-- | src/runtime/map_test.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/map_test.go b/src/runtime/map_test.go index 81f05a0613..59e9c94c3f 100644 --- a/src/runtime/map_test.go +++ b/src/runtime/map_test.go @@ -635,7 +635,7 @@ func benchmarkMapAssignInt32(b *testing.B, n int) { } func benchmarkMapDeleteInt32(b *testing.B, n int) { - a := make(map[int32]int) + a := make(map[int32]int, n*b.N) for i := 0; i < n*b.N; i++ { a[int32(i)] = i } @@ -653,7 +653,7 @@ func benchmarkMapAssignInt64(b *testing.B, n int) { } func benchmarkMapDeleteInt64(b *testing.B, n int) { - a := make(map[int64]int) + a := make(map[int64]int, n*b.N) for i := 0; i < n*b.N; i++ { a[int64(i)] = i } @@ -680,7 +680,7 @@ func benchmarkMapDeleteStr(b *testing.B, n int) { for i := 0; i < n*b.N; i++ { k[i] = strconv.Itoa(i) } - a := make(map[string]int) + a := make(map[string]int, n*b.N) for i := 0; i < n*b.N; i++ { a[k[i]] = i } |
