Skip to content

Instantly share code, notes, and snippets.

@begetan
Last active December 18, 2016 00:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save begetan/1a6dab06082e41da4fe493fb43aaba5e to your computer and use it in GitHub Desktop.
Save begetan/1a6dab06082e41da4fe493fb43aaba5e to your computer and use it in GitHub Desktop.
Golang test of Map random filling
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