August 2019
Beginner to intermediate
798 pages
17h 2m
English
In this subsection, we are going to use a map that stores plain values without pointers. The Go code of mapNoStar.go is as follows:
package main
import (
"runtime"
)
func main() {
var N = 40000000
myMap := make(map[int]int)
for i := 0; i < N; i++ {
value := int(i)
myMap[value] = value
}
runtime.GC()
_ = myMap[0]
}
As before, a for loop is used for putting the integer values into the map.
Read now
Unlock full access