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

x/tools/gopls: hover: show fraction of wasted space in structs #66582

Closed
adonovan opened this issue Mar 28, 2024 · 1 comment
Closed

x/tools/gopls: hover: show fraction of wasted space in structs #66582

adonovan opened this issue Mar 28, 2024 · 1 comment
Assignees
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

adonovan commented Mar 28, 2024

https://go.dev/cl/573076 (pending) augments gopls' hover information with the size and offset of each field when viewing a struct. A recent discussion about the fieldalignment analyzer (which is disabled due to high false positives) made me wonder whether any static analysis (as opposed to dynamic analysis using the heap profiler) had anything to offer. I think it might: we could compute the size of the struct as if the fields were in space-optimal order (largest to smallest), and if this is significantly smaller than the actual size, or falls into a different allocator size class), then we could report the waste fraction too.

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Mar 28, 2024
@gopherbot gopherbot added this to the Unreleased milestone Mar 28, 2024
@suzmue suzmue modified the milestones: Unreleased, gopls/backlog Mar 28, 2024
@adonovan adonovan self-assigned this Mar 31, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/575375 mentions this issue: gopls/internal/golang: Hover show wasted % of struct space

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants