Mastering-Go-Second-Edition/ch03/mapNoStarTime.go
2019-01-23 19:10:17 +02:00

24 lines
319 B
Go

package main
import (
"fmt"
"runtime"
"time"
)
func main() {
var N = 40000000
myMap := make(map[int]int)
for i := 0; i < N; i++ {
value := int(i)
myMap[value] = value
}
start := time.Now()
runtime.GC()
duration := time.Since(start)
fmt.Println("It took GC()", duration, "to finish")
_ = myMap[0]
}