-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
net: sloppy struct field arrangement could be re-arranged for more compact structs #42415
Comments
I don’t think there is a lot of value of analysing _test.go files. |
Sure, It's just an analysis pass, so I think it currently does the same as what analysis passes do. Is there an option for analysis pass skip test files 🤔 |
@davecheney does have a point, I thought about that too, but we were trying to be as thorough as possible! |
The struct identified here - type dnsConfig - is something that there's typically only one of in an entire program. The savings of 16 bytes in an entire program, at the cost of making the struct field list less natural to read, is not worth it. Echoing what I wrote on #42412, you can improve the targeting of your suggestions by combining your tool with memory profiles. It's important not to make changes to code that doesn't actually have any benefit to being changed. That can only introduce bugs - all risk, no reward. |
Given that dnsConfig shouldn't be changed and the other is in a test and shouldn't be changed, closing this. |
Coming here from tip ecc3f51, with one of the static analysis tools, we have developed at Orijtech, Inc., we've found 2
fields in the net package that could be re-arranged for optimal sizes, hence the usage of "sloppy struct field arrangement".
And here they are
The text was updated successfully, but these errors were encountered: