-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: binary.PutUint64 performance degradation in 1.10 #24078
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
Comments
Last time I saw a performance issue like that, it turned out that the performance of the CPU was sensitive to the alignment of the function in memory. That said, this function seems small enough that it is likely to be inlined. Do you have a larger benchmark that shows the same regressions, or do they only occur in microbenchmarks? (That is, what is the impact of the regression on the overall program, rather than just the benchmark?) |
Perhaps the function used to be inlined, but isn't being inlined anymore? |
This is not completely true. The 1.10 function is slightly larger. 1.9:
1.10 (note
the reason the 1.10 is larger is that it has one more panicindex
at the bottom. 1.9 has three, 1.10 has four. |
Spot on @mvdan! Go 1.10 does no longer inline these functions into the Benchmark functions. I was just about to apply this function and for as far as I know there are no users yet @bcmills. I care not so much for this specific case yet this could have been something not visible for most cases. The panic case is not benchmarked @ALTree. The help is much appreciated. Thanks a bunch. |
I'm confused - are you closing this because Go 1.10 no longer inlines calls made in benchmark functions by design? |
I know that. But the function size sometime matters in microbenchmarks. Also why did you close this? Is the fact that the function is no longer inlined expected? |
Weather the compiler inlines a function or not can hardly be a bug right? And this might be triggered by the slightly larger size indeed. I was worried that some essential was seriously off. |
I would expect that, given that PutUint64 hasn't changed between 1.9 and 1.10, the compiled code should be the same or better - not worse. Unless I'm missing something obvious? One way or another, no harm in leaving this open in case there is actually a compiler regression somewhere. |
It absolutely can. We are definitely interested in understanding why your function is no longer inlined in 1.10. |
1.10 "-m -m" says
while 1.9 inlines it without complaining. |
I believe this is caused by the fix for #19261. 1.9 inlines the function because it incorrectly computed a cost of 0 for cross-package calls like So I believe this is WAI. |
I think https://go-review.googlesource.com/c/go/+/95475 is relevant here |
Closing this, since it is expected that the function is no longer inlined (i linked the fix that caused this above). |
Two little highly-optimised functions suffer from serious performance when compared to Go version 1.9.
The assembler output from
go build -gcflags=-S
is exactly the same so I don't know where to look for. If anybody can give me some pointers I'd be happy to build a clean test case.Here follows a snippet from https://github.com/pascaldekloe/flit for context.
The text was updated successfully, but these errors were encountered: