3 ms·
> why the compiler shouldn't reorder structs so that they take the least space possible I think you'd get most of the benefit by writing a static analysis tool
by neilc 11y ago
> why the compiler shouldn't reorder structs so that they take the least space possible
I think you'd get most of the benefit by writing a static analysis tool (a la "go vet") that suggests when reordering a struct's fields would reduce memory consumption.
- masklinn 11y agoExcept Go doesn't guarantee source-order struct layout, so that'd be a suggestion relying on implementation details (see also: relying on scheduling order of goroutines).