Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active August 6, 2021 11:39
Show Gist options
  • Save percybolmer/49beb83f485322d2645441d8a8bc8714 to your computer and use it in GitHub Desktop.
Save percybolmer/49beb83f485322d2645441d8a8bc8714 to your computer and use it in GitHub Desktop.
// insertXPreallocIntSlice is used to add X amount of items into a []int
func insertXPreallocIntSlice(x int, b *testing.B) {
// Initalize a Slice and insert X amount of Items
testSlice := make([]int, x)
// reset timer
b.ResetTimer()
for i := 0; i < x; i++ {
testSlice[i] = i
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment