3 ms·
The article mentions that the "Go spec says the address of a struct’s fields must be naturally aligned", and seems to take for granted that is necessary for spe
by nkurz 11y ago
The article mentions that the "Go spec says the address of a struct’s fields must be naturally aligned", and seems to take for granted that is necessary for speed. A separate question would be whether it actually helps performance.
For modern x64/x86 the answer seems be to "no": http://lemire.me/blog/2012/05/31/data-alignment-for-speed-myth-or-reality/ http://lemire.me/blog/2012/05/31/data-alignment-for-speed-my...
Would it make sense for the Go spec to drop the alignment requirement? I'd think that a smaller memory footprint would be the better choice, and I'd think that interoperability would be better served by allowing arbitrary alignments.