Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: struct equality code optimization #39428
The array equality function looks optimal. It compares each length in turn and branches to "return false" if any don't match. If all the lengths match, then it calls
The code for struct equality looks worse.
The length-same (calling memequal) and length-different branches recombine, requiring retesting of the result, which then skips over the remaining tests (and not all the rest, but one at a time).