Skip to content
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: rearrange hairyVisitors to reduce struct slop and reclaim 33.33% space wasted #42416

Open
odeke-em opened this issue Nov 6, 2020 · 2 comments
Labels
Milestone

Comments

@odeke-em
Copy link
Member

@odeke-em odeke-em commented Nov 6, 2020

Coming here from tip ecc3f51, with one of the static analysis tools, we have developed at Orijtech, Inc., we've found a
struct that we could re-arrange and reclaim 33.33% of the RAM each struct uses

$ structslop .
cmd/compile/internal/gc/inl.go:300:19: struct has size 40 (size class 48), could be 32 (size class 32),
rearrange to  struct{reason string; usedLocals map[*Node]bool; budget int32; extraCallCost int32} for
optimal size (33.33% savings)

hairyVisitors seems like a potentially frequently created struct, so these savings could directly be quantifiable in compilations.

@gopherbot
Copy link

@gopherbot gopherbot commented Nov 6, 2020

Change https://golang.org/cl/267978 mentions this issue: cmd/compile: re-arrange hairyVisitors inline helper for efficiency

@rsc
Copy link
Contributor

@rsc rsc commented Nov 6, 2020

This one is again not something that there are many of. This variable is declared as a local to hold state before a recursive walk of a function body. It's a miniscule percentage of a tiny fraction of the overall compiler memory usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.