You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
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?