Re: [go-nuts] Weird benchmark results for seemingly identical functions

2020-06-23 Thread Yonatan Ben-Nes
func timeAppend(suffixArray []string) (lcp []int) { lcp = append(lcp, 0) return lcp } Thanks again in advance :) On Monday, June 22, 2020 at 8:19:08 PM UTC+3 Yonatan Ben-Nes wrote: > Oh the shame > > Thank you for pointing that out :) > > On Mon, 22 Jun 2020, 20:03 Martin Sch

Re: [go-nuts] Weird benchmark results for seemingly identical functions

2020-06-22 Thread Nimrod Yonatan Ben-Nes
he second example exits on the first > iteration. > > for pos := 0; true; pos++ { > if pos < suffixLen && pos < previousSuffixLen { > continue > } > break > } > > On 22.06.20 14:15, Yonatan Ben-Nes wrote: > > Hi, > > > >

[go-nuts] Weird benchmark results for seemingly identical functions

2020-06-22 Thread Yonatan Ben-Nes
Hi, I'm encountering a weird issue which I fail to explain. It boils down to 2 almost identical functions which give wildly different benchmark results. The difference between the functions is that at the slow func there is a for loop like this: for pos := 0; pos < suffixLen && pos < previousSu