-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: exponential behavior for deeply nested structs #65540
Comments
Change https://go.dev/cl/561875 mentions this issue: |
Change https://go.dev/cl/561936 mentions this issue: |
Looking at this a bit more, the exponential behavior is in both |
Change https://go.dev/cl/571543 mentions this issue: |
Change https://go.dev/cl/571542 mentions this issue: |
I will look into the validType issue again. The previously existing code was wrong, even though it helped in this case. |
… demand For #65540 Actually more correct in some very weird, and probably impossible to trigger currently, cases. For instance, a struct with a NOEQ and a NOALG field (the old code would not report the noalg bit). Change-Id: I36c473b59aa5775d8a520ac746b114d16a22699d Reviewed-on: https://go-review.googlesource.com/c/go/+/571542 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Compute ptrBytes while computing the size of a type. Requires an extra field on the type, but means that we don't have potentially exponential behavior in the PtrDataSize computation. For #65540. Change-Id: Ia23c72bbd996730baddd32d9ed46cfc00c3472ee Reviewed-on: https://go-review.googlesource.com/c/go/+/571543 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Optimization for esoteric cases. Moving to 1.25. |
Go version
tip
Output of
go env
in your module/workspace:What did you do?
test.go
:Compile with
It takes a surprisingly long time. The pprof output points to
cmd/compile/internal/types/alg.go:AlgType
as the culprit. It is walking the exponential-sized object to determine its algorithm class. It should probably memoize the computation somehow so it isn't exponential.Add more lines to the example to make it even more slower.
Found during discussion in #65495.
What did you see happen?
What did you expect to see?
Fast compilation.
The text was updated successfully, but these errors were encountered: