Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active August 6, 2021 11:39
Show Gist options
  • Save percybolmer/b378b3023eb3146edb19781bc510c7ec to your computer and use it in GitHub Desktop.
Save percybolmer/b378b3023eb3146edb19781bc510c7ec to your computer and use it in GitHub Desktop.
// insertXIntMap is used to add X amount of items into a Map[int]int
func insertXIntMap(x int, b *testing.B) {
// Initialize Map and Insert X amount of items
testmap := make(map[int]int, 0)
// Reset timer after Initalizing map, that's not what we want to test
b.ResetTimer()
for i := 0; i < x; i++ {
// Insert value of I into I key.
testmap[i] = i
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment