-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: rerwrite cycle detection logic taking too long for large functions #66773
Comments
have you considered not having 10000 lines of cc @golang/compiler |
Of course, this is meaningless. It's just that I'm curious why it's possible in go1.18 |
Ordinarily it would be as @seankhliao says ... "don't do that". However there is actually something interesting going on here. I patched this change into my Go repo:
Then I did a test compile, e.g.
Looking at this profile, I see:
It looks as though what's happening is that this code here is kicking in: E.g. because of the enormous size of the function, the rewriter notices that there have been a large number of rewrites, so it turns on the cycle-detection logic. For this enormous func, however, the cycle detection logic takes a couple of orders of magnitude more time than the rewriting itself. If I comment out the cycle detection logic, the file compiles in about 90 seconds. I think this is probably actionable, we can change things to skip the cycle detection logic if the function itself is over some size limit. |
Change https://go.dev/cl/578215 mentions this issue: |
Go version
go version go1.21.9 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
The code gets stuck when building it with go1.21, but it builds fine with go1.18
What did you see happen?
It keeps getting stuck when building the source code below using the command:
code.zip
What did you expect to see?
It can be built normally using go1.21 or higher version
The text was updated successfully, but these errors were encountered: