OLD | NEW |
1 // Copyright 2013 The Go Authors. All rights reserved. | 1 // Copyright 2013 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package runtime_test | 5 package runtime_test |
6 | 6 |
7 import ( | 7 import ( |
8 "fmt" | 8 "fmt" |
9 "math" | 9 "math" |
10 "runtime" | 10 "runtime" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 b[empty{}] = 1 | 273 b[empty{}] = 1 |
274 c[empty{}] = empty{} | 274 c[empty{}] = empty{} |
275 | 275 |
276 if len(a) != 1 { | 276 if len(a) != 1 { |
277 t.Errorf("empty value insert problem") | 277 t.Errorf("empty value insert problem") |
278 } | 278 } |
279 if b[empty{}] != 1 { | 279 if b[empty{}] != 1 { |
280 t.Errorf("empty key returned wrong value") | 280 t.Errorf("empty key returned wrong value") |
281 } | 281 } |
282 } | 282 } |
| 283 |
| 284 func BenchmarkNewEmptyMap(b *testing.B) { |
| 285 b.ReportAllocs() |
| 286 for i := 0; i < b.N; i++ { |
| 287 _ = make(map[int]int) |
| 288 } |
| 289 } |
OLD | NEW |