Last active
December 18, 2016 00:51
-
-
Save begetan/1a6dab06082e41da4fe493fb43aaba5e to your computer and use it in GitHub Desktop.
Golang test of Map random filling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
) | |
func main() { | |
var set = make(map[int]bool) | |
for i := 0; i <= 1000000000; i++ { | |
set [rand.Intn(30)] = true; | |
} | |
fmt.Printf("%v\n",set) | |
} | |
// Compare with Java HashMap, which is about 5 times faster | |
// https://gist.github.com/begetan/3bf5652ef0b30e92632208a4578ea3a3 | |
// Compare with Python HashMap, which is about 10 times slower | |
// https://gist.github.com/Uznick/2104eba589e393d7c277e4cefaa1771e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment