When Ivan Reese talks about the data model in Hest (Hest Podcast, Episode 25), he mentions things like:
- AOS: Array of Structs
- SOA: Struct of Arrays
He also mentions a way to organise data where each property (name, color, position, …) is stored in its own Array – in contrast to an Array of Objects of Properties.
This reminded me of a talk I had seen at Unite (Unity Conference) about “Data-Oriented Design”. While it makes a lot of sense in terms of memory usage, caching and lookup performance, I barely see data-oriented design today.
What are examples of programming languages or software that are using/promote data-oriented design outside of game development?
Scientific computing has much of the same issues as games: large but simply structured datasets, and dealing with hardware limitations in memory and performance. But explicit support in programming languages is rare. One reason why there was a lot of enthusiasm for C++ for scientific computing in the 1990s was the hope for managing the AOS vs. SOA tradeoff better than in Fortran. Not sure it was a success.
Probably, "the languages promoting data-oriented design" are exactly "array programming languages", which are kinda popular again later with the spread of GPGPU, but mostly around scientific computing, DSP and alike. 🙂
Besides, just SoA isn't efficient enough on modern hardware considering all levels of caching, NUMA and vectorization. Thus in practice for maximum performance people use combined layouts like SoAoS. But for that you have to know the sizes and layouts of your base structures, where and how they are used, and adapt algorithms for that. So no "one size fits all" solution here, it's all careful conscious and methodical manual optimisation.
I know Andrew Kelly just applied some data oriented techniques to zig for compiler performance improvements. https://vimeo.com/507318005
I’d recommend looking at https://www.youtube.com/watch?v=Oj_xgO2uKJM&t=1s. And also Aarons Hsu’s thesis.
Jonathan Blow's work-in-progress programming language Jai has language-level support for AOS and SOA:
However, as programs get larger, it becomes much more difficult to reorganize the data. Testing whether a single, simple change has any effect on performance can take the developer a long time, because once the data structures must change, all of the code that acts on that data structure breaks. So Jai provides mechanisms for automatically transitioning between SoA and AoS without breaking the supporting code.
Which makes me wonder if this sort of generality of data access is similar to the approach Clojure takes to its data structures — and if so, whether they're directly aligned or lie along slightly different axes.
For what it is worth I am fairly sure that Jonathan Blow got rid of those abilities. Instead you have macros and arbitrary compile time code execution that would let you reimplement something like that yourself.
Anytime someone talks about a column store vs a row store, they’re effectively talking about SoA vs AoS