4 ms·
Access patterns matter, but just as important is to have less stuff to access. That's why arrays-of-structs are considered cache friendly - columnar data layout
by 10000truths 2y ago
Access patterns matter, but just as important is to have less stuff to access. That's why arrays-of-structs are considered cache friendly - columnar data layouts open the door to optimizations that significantly reduce memory footprint. You no longer waste memory with struct padding. Boolean fields can become bitsets. Enums can be bit-packed. Often-null optional fields can become sparse maps. 8-byte pointers can become narrower-sized indices into object pools.
- pavlov 2y ago> “That's why arrays-of-structs are considered cache friendly” Sounds like you mean structs-of-arrays?
- 10000truths 2y agoOops, brainfart on my part. Unfortunately, the edit window has passed.