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: make compiler reorganize user structs without having user code modify fields so userland readability can come first #42428

Closed
odeke-em opened this issue Nov 6, 2020 · 4 comments

Comments

@odeke-em
Copy link
Member

odeke-em commented Nov 6, 2020

Coming here from an offline discussion with @aclements, in regards to a new static analysis pass "structslop" that Orijtech, Inc. just released and related issues:

The concern is that by having a static analysis pass that coerces users into statically optimized changes that might have adverse effects, like ruining their readability, ruining co-location and cache line blowing.

A compiler pass as @aclements mentioned would solve these issues, but another benefit would be scalable development whereby every Go developer would get these benefits without having to run a separate pass, it won't interfere with code reviews nor blindly make recommendations that few people can reason about.

/cc @cuonglm @martisch @randall77 @aclements @dr2chase @mknyszek.

@odeke-em
Copy link
Member Author

odeke-em commented Nov 6, 2020

A somewhat similar proposal that's currently on hold #36606, brought to my attention offline by @rsc.

@rsc
Copy link
Contributor

rsc commented Nov 6, 2020

We can't reorder fields until there is a way to signal "don't reorder fields". That way was going to be and may still be //go:packed (#36606), but that work is put to the side to focus on generics.

Past discussion about reordering struct fields is #10014.

@rsc
Copy link
Contributor

rsc commented Nov 6, 2020

This issue can probably be closed as a duplicate of #36606. I don't think we need to keep both open.

@odeke-em
Copy link
Member Author

odeke-em commented Nov 6, 2020

SGTM, thank you @rsc for chiming in with the background.

@odeke-em odeke-em closed this as completed Nov 6, 2020
@golang golang locked and limited conversation to collaborators Nov 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants