August 2019
Beginner to intermediate
798 pages
17h 2m
English
The implementation of this subsection will split the map into a map of maps, which is also called sharding. The program of this subsection is saved as mapSplit.go and will be presented in two parts. The first part of mapSplit.go contains the following Go code:
package main
import (
"runtime"
)
func main() {
var N = 40000000
split := make([]map[int]int, 200)
This is where the hash of hashed is defined.
The second part is as follows:
for i := range split {
split[i] = make(map[int]int)
}
for i := 0; i < N; i++ {
value := int(i)
split[i%200][value] = value
}
runtime.GC()
_ = split[0][0]
}
This time, we are using two for loops: one for loop for creating the hash of hashes and another one for storing the desired data in the ...
Read now
Unlock full access