-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: Go 1.19 might make generic types slower #54238
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
does |
This was caused by https://go-review.googlesource.com/c/go/+/395854 . It was a deliberate change to avoid inlining in cases where we were running into bugs. |
Since unified IR is expected to fix this, I'm going to assign this @mdempsky for visibility, but feel free to unassign. |
Here is an article by Vincent Marti that talks about this issue in details: Here is a snippet of this summary: I wonder if we could have a more performance-oriented go compiler. I, and am sure many others would trade a few seconds of compilation for production with the hope of getting a super optimized binary. Heck, I would wait an entire minute for it. Go has the potential to match the performance that Rust offers, even with the GC on, but some internal force is always somehow opposing that. |
It's not a mystery: the internal opposing force is compilation time. |
@ianlancetaylor I would like to know the answer to these questions in order to educate myself first so I can educate others that I have seen with the same questions.
|
|
The problem you mentioned suggests opening a new thread, it's not the same problem as the one I mentioned, what you quoted is trying to show that the overhead of dynamic lookup methods is expensive, this problem is simply a collection of types (according to the previous reply, 1.20 will be fixed) |
@ianlancetaylor What is the direction you guys want to go in regards to point 3? Modest optimizations over time while preserving the compilation speed? |
It is a very interesting question but it does not seem relevant to the issue in question. I think you might want to take the discussion elsewhere. |
@Jacalz Understood and apologies! What is the best way to initiate a conversation like this? Via an issue? |
@AAlvarez90 Yes, there is a standard template for reference |
Please only use issues for actual bugs and proposals. For general discussions there are other forums, see https://github.com/golang/go/wiki/Questions |
Thanks. I will bookmark these resources. Sorry for the noise I brought up here. |
At tip [edit: to eventually become Go 1.20] I get:
|
@kscooo The benchmarks I posted are for what will eventually become Go 1.20. We're not going to make any changes to Go 1.19, sorry. |
@mdempsky nice, forgive me for not knowing that you are testing with 1.20 |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
It reproduces on the 1.19
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
playground: https://go.dev/play/p/6UxOn6pftVs
main_test.go
What did you expect to see?
1.19 should be similar to the 1.18 benchmark test, not much slower.
What did you see instead?
goversion: 1.19
goversion: 1.18
The assembly generated by 1.19 is found to have more
main..dict.add[int](SB), AX
main..dict.add[string](SB), AX
These lines are directly inlined in 1.18.
/cc @ianlancetaylor
The text was updated successfully, but these errors were encountered: