-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: inline is slower #51028
Comments
Inner loop in the noninlined case:
In the inlined case:
There's a nop pad to align the cmp/jlt to fix #35881. That could conceivably be the reason for the slowdown, in which case the performance difference is just because we got alignment-lucky in the noninline case and alignment-unlucky in the inline case. The first one seems like there's nothing to fix, except possibly to revert the #35881 fix some day. (If I revert it on my desktop right now, the performance goes down by a factor of 2! So not today.) The second one would need some sort of partial lifting out of the loop. That's #15808, with the additional complication here that we'd have to break a single instruction into 2 parts and lift just one of those parts out of the loop. So I don't think there's anything to do for this issue. I'm going to close in favor of #15808. (This doesn't reproduce for 1.17 because we don't inline functions with loops in 1.17.) |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Not for go1.17.6, only for 1.18 beta 2.
What did you do?
What did you expect to see?
The inlined function is faster.
What did you see instead?
The inlined one is slower.
The text was updated successfully, but these errors were encountered: