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
go/types: audit memory usage for go1.17 #45580
Comments
Marking this as a release blocker until we determine that any memory regressions are acceptable. |
@findleyr Checking in as this is a release-blocker. Is this acceptable to do after Beta 1? |
Thanks Alex! This is okay after Beta 1, marked it accordingly. I expect we'll address this before Beta 1, though. |
Change https://golang.org/cl/318849 mentions this issue: |
Update: measured a couple ways, I was consistently seeing around a 6% increase in memory footprint when working on x/tools. CL 318849 should unpin the Checker, which in my testing almost exactly reclaimed the 6% regression. I also tried externalizing object.color_ and object.order_ into maps, but this didn't seem to make much difference in memory footprint and slowed down the type checking pass by 2-4%. There may be something worth pursuing there, but not for 1.17. |
Change https://golang.org/cl/323030 mentions this issue: |
Change https://golang.org/cl/322974 mentions this issue: |
When importing generic named types, it is possible for Checker.newNamed to be called during type instantiation when the Checker is nil. In this case we should be able to safely skip this delayed expansion. Updates #45580 Change-Id: I75422100464d57eba24642c93e06e8b47d904fc3 Reviewed-on: https://go-review.googlesource.com/c/go/+/322974 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
… is nilled out once it is expanded This is a port of - https://golang.org/cl/318849 - https://golang.org/cl/322974 For #45580. Change-Id: Ie0700ed6c8d472305d5ba7ff97da1ae063152aa3 Reviewed-on: https://go-review.googlesource.com/c/go/+/323030 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
With the merging of the dev.typeparams branch, a number of the types in go/types picked up additional fields that are only used during the type checking pass. Many users of go/types (particularly gopls) are sensitive to the memory footprint of a type checked package. Filing this issue as a reminder for go1.17: we should verify that we're not pinning memory unnecessarily.
I did a quick check using both pprof and a memory debugging tool that @heschi is experimenting with for gopls, and they indicated that typechecked packages in go1.17 consume perhaps 5-10% more memory than in go1.16. We're not yet convinced that these are accurate numbers, but such a relative change is probably meaningful. If accurate, a 5-10% increase is not so bad, though we could probably eliminate it.
CC @griesemer
The text was updated successfully, but these errors were encountered: