cmd/compile: loops compiled differently when using range or index #31205
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What did you do?
I compiled two functions that sum all the elements of a slice of bytes using "range" or using an index:
"Range" version:
Index version:
What did you expect to see?
I expected both versions of the function to compile to the exact same code.
What did you see instead?
Instead, the looping part of the function is different, resulting in differences in performance:
"Range" version:
Index version:
The text was updated successfully, but these errors were encountered: