@@ -371,44 +371,3 @@ func testMapLookups(t *testing.T, m map[string]string) {
371
371
}
372
372
}
373
373
}
374
-
375
- func TestMapSize (t * testing.T ) {
376
- if runtime .GOMAXPROCS (- 1 ) != 1 {
377
- t .Skip ("gomaxprocs > 1 - not accurate" )
378
- }
379
- var m map [struct {}]struct {}
380
- size := bytesPerRun (100 , func () {
381
- m = make (map [struct {}]struct {})
382
- })
383
- if size > 48 {
384
- t .Errorf ("size = %v; want <= 48" , size )
385
- }
386
- }
387
-
388
- // like testing.AllocsPerRun, but for bytes of memory, not number of allocations.
389
- func bytesPerRun (runs int , f func ()) (avg float64 ) {
390
- defer runtime .GOMAXPROCS (runtime .GOMAXPROCS (1 ))
391
-
392
- // Warm up the function
393
- f ()
394
-
395
- // Measure the starting statistics
396
- var memstats runtime.MemStats
397
- runtime .ReadMemStats (& memstats )
398
- sum := 0 - memstats .Alloc
399
-
400
- // Run the function the specified number of times
401
- for i := 0 ; i < runs ; i ++ {
402
- f ()
403
- }
404
-
405
- // Read the final statistics
406
- runtime .ReadMemStats (& memstats )
407
- sum += memstats .Alloc
408
-
409
- // Average the mallocs over the runs (not counting the warm-up).
410
- // We are forced to return a float64 because the API is silly, but do
411
- // the division as integers so we can ask if AllocsPerRun()==1
412
- // instead of AllocsPerRun()<2.
413
- return float64 (sum / uint64 (runs ))
414
- }
0 commit comments