I am trying to optimize the loop performance by reducing the number of bound checks. Inside the loop I compute a slice index and access two slice indexes like this:
j := i / 2 s[j+1] = i s[j] = i // <- I want to get rid of this bound check I assumed that I can get rid of the second bound check, as the compiler could already know that j+1 < len(s) and j >= 0. Am I missing something? Any suggestions how to solve this? The full boiled down code to reproduce my issue is here: https://go.godbolt.org/z/hsjPh3WT7 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/832957ee-05c9-44cb-9c0c-67ecff8068bfn%40googlegroups.com.