detect when rearrangement changes the size class
odeke-em opened this issue · comments
Coming here from a suggestion from Josh Bleecher Snyder, we should detect when the rearrangement changes the size class of the struct.
@odeke-em do you refer to the size class that runtime use to allocate memory for struct? https://golang.org/src/runtime/mksizeclasses.go
That's right! Please see also see golang/go#42412 (comment)
Look cool!
So when size class changed, what should we report? Or we will report the actual size class instead of the struct size?
We should report all of them. Basically:
<LINENO_POS>: struct has size 112 (size class <CLASS_SIZE>), rearrange to <REARRANGEMENT> for optimal size
Also we should make sure that the optimal size suggested is an actual size class.
For brevity here are the size classes from the Go runtime https://github.com/golang/go/blob/ecc3f5112ebaf23c4b1ac4c5eedfa406d82ecc9a/src/runtime/sizeclasses.go#L6-L73