News for hackers. Stuff that matters.
Re:Practical Go benchmarks by dmitrim on Wednesday March 07, 2018 @03:54AM (#16535142)
Thanks for pointing it out. Should clearly not depend on the number of iterations. It's fixed now.
Re:Practical Go benchmarks by fauigerzigerk on Wednesday March 07, 2018 @09:24AM (#16536512)
I think there's another bug in the generateSlice function if the intention is to create a slice with n random numbers.

    func generateSlice(n int) []int {
        s := make([]int, n)
        for i := 0; i < n; i++ {
            s = append(s, rand.Intn(1e9))
        }
        return s
    }
As it is now, the function creates a slice with n zeros followed by n random numbers. I suppose you meant to say make([]int, 0, n). You could just as well assign directly to each slice element instead of using append, which would be more efficient.

I made the exact same mistake quite a few times myself.

Re:Practical Go benchmarks by dmitrim on Wednesday March 07, 2018 @09:41AM (#16536656)
Yep, that meant to be capacity, not length. Corrected. Thanks!