4 // Copyright 2013 The Go Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style
6 // license that can be found in the LICENSE file.
8 // Test that NaNs in maps don't go quadratic.
20 // Test that NaNs in maps don't go quadratic.
21 t
:= func(n
int) time
.Duration
{
23 m
:= map[float64]int{}
25 for i
:= 0; i
< n
; i
++ {
29 panic("wrong size map after nan insertion")
34 // Depending on the machine and OS, this test might be too fast
35 // to measure with accurate enough granularity. On failure,
36 // make it run longer, hoping that the timing granularity
37 // is eventually sufficient.
39 n
:= 30000 // ~8ms user time on a Mid 2011 MacBook Air (1.8 GHz Core i7)
44 // should be 2x (linear); allow up to 3x
50 panic(fmt
.Sprintf("too slow: %d inserts: %v; %d inserts: %v\n", n
, t1
, 2*n
, t2
))