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
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@odeke-em
Copy link
Member

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 commented Nov 6, 2020

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

@toothrot toothrot added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Nov 6, 2020
@toothrot toothrot added this to the Backlog milestone Nov 6, 2020
@rsc
Copy link
Contributor

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.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
Status: Triage Backlog
Development

No branches or pull requests

4 participants