How misaligning data can increase performance by reducing cache misses (2014)
danluu.com
danluu.com
You know what would make it better is if it added the number of past submissions just like total comments.
2 past
5 comments
Two cache lines of 64 bytes each are cached on even a single byte access, so of course it will be faster to pack data together, but who thought differently? It also saves TLB cache misses as well and if accessed linearly will be prefetched.
One fix is to ensure that these objects are stored at locations that don't share so many common bits, or for the CPU to actually have a hash function that it uses on the address, rather than using the address as-is.