Check out https://github.com/dominikh/go-tools/tree/master/cmd/structlayout 
and https://github.com/dominikh/go-tools/tree/master/cmd/structlayout-optimize


On Wednesday, February 6, 2019 at 8:20:06 PM UTC-8, Kurtis Rader wrote:
>
> > Is it practical to auto rearrange struct fields to reduce paddings in Go?
>
> Auto rearrange? Probably not. Manual rearrange? Maybe, if the struct isn't 
> part of a public API. If the struct is part of a private API removing the 
> padding could be counterproductive or harmful to performance if the layout 
> is intended to minimize false cache sharing between CPUs. Obviously whether 
> or not padding will be present also depends on the machine architecture. So 
> the author may intend for that padding (or lack thereof) because it 
> maximizes performance or some other metric on their platform.
>
> -- 
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to