Re:The x86 architecture is the weirdo (2004)
by ncmncm on Tuesday April 19, 2022 @06:15PM
(#31090025)
True. Another reason to avoid too much aligning is to help reduce reliance on N-way cache collision avoidance.
Caches on modern chips can handle keeping up to some small fixed number, often 4, objects all in cache whose addresses are at the same offset into a page, but performance may collapse if that number is exceeded. It is quite hard to tune to avoid this, but by making things not line up on power-of-two boundaries, we can avoid out-and-out inviting it.
The last time I worked on a btree-based data store, changing the nodes from ~1024 bytes to ~1000 delivered something like a 10% throughput improvement. This was done by reducing the number of entries in each node, and not by changing padding or packing.