4 ms·
Unfortunately it is not as simple when you have to account for different threads on different cores accessing the same structure, as mentioned in the article. [
by devbug 12y ago
Unfortunately it is not as simple when you have to account for different threads on different cores accessing the same structure, as mentioned in the article. [1] Or the performance implications of managing multiple instances of structures. [2] Or the alignment requirements for doing SIMD. [3]
Additionally, it sometimes makes sense to duplicate data to minimize cache misses. For example, translating/rotating/scaling entities in game engines. It makes sense to copy entity transforms (usually a matrix computed once) from a central manager to sub-managers for certain components. The memory overhead is traded for more efficient processing in sub-systems like rendering, animation, physics, etc.
---
[1]: http://en.wikipedia.org/wiki/False_sharing http://en.wikipedia.org/wiki/False_sharing
[2]: https://software.intel.com/en-us/articles/a-case-study-comparing-aos-arrays-of-structures-and-soa-structures-of-arrays-data-layouts https://software.intel.com/en-us/articles/a-case-study-compa...
[3]: https://software.intel.com/sites/products/documentation/doclib/iss/2013/compiler/cpp-lin/GUID-A8921E64-6201-4018-BAE8-DE58E4E6ECB3.htm https://software.intel.com/sites/products/documentation/docl...