data-oriented design is the practice of designing software by developing transforms for well-formed data where well-formed is guided by the target hardware and the transforms that will operate on it. Sometimes the data isn't well defined, and sometimes the hardware is equally evasive, but in most cases a good background of hardware appreciation can help out almost every software project.
Questions tagged [data-oriented-design]
74 questions
210
votes
6 answers
What is data oriented design?
I was reading this article, and this guy goes on talking about how everyone can greatly benefit from mixing in data oriented design with OOP. He doesn't show any code samples, however.
I googled this and couldn't find any real information as to what…

ryeguy
- 65,519
- 58
- 198
- 260
29
votes
1 answer
Is my understanding of AoS vs SoA advantages/disadvantages correct?
I've recently been reading about AoS vs SoA structure design and data-oriented design. It's oddly difficult to find information about either, and what I have found seems to assume greater understanding of processor functionality than I possess. That…

P...
- 655
- 2
- 6
- 14
24
votes
2 answers
Data-oriented design in practice?
There has been one more question on what data-oriented design is, and there's one article which is often referred to (and I've read it like 5 or 6 times already). I understand the general concept of this, especially when dealing with, for example,…

falstro
- 34,597
- 9
- 72
- 86
20
votes
2 answers
Memory layout in Javascript - data-oriented vs object-oriented design
Coming from a background of C/C++, memory layout of objects with regards to reducing cache misses is something that is crucial especially when working on consoles. Data-oriented design is often favored over object-oriented design, in order to help…

smg
- 1,133
- 1
- 11
- 22
17
votes
7 answers
Understanding cache-friendly, data-oriented objects and handles
using namespace std;
Consider a traditional OOP approach to entity/object management:
struct Entity { bool alive{true}; }
struct Manager {
vector> entities; // Non cache-friendly
void update() {
//…

Vittorio Romeo
- 90,666
- 33
- 258
- 416
17
votes
4 answers
Data oriented access to several indexed data arrays
I am working on an entity component system for a game engine. One of my goals is to use a data oriented approach for optimal data processing. In other words, I want to follow the guideline of rather wanting structs of arrays than arrays of structs.…

Tobias
- 924
- 9
- 23
14
votes
3 answers
Data-oriented tree traversal without recursion
I have a tree structure like this: a Model has a root Node and each Node has any number of child Nodes and also any number of Meshes.
A lot of the time in my application is spent traversing this tree and doing computations like view frustrum culling…

KaiserJohaan
- 9,028
- 20
- 112
- 199
12
votes
4 answers
Which is most cache friendly?
I am trying to get a good grip on data oriented design and how to program best with the cache in mind. There's basically two scenarios that I cannot quite decide which is better and why - is it better to have a vector of objects, or several vectors…

KaiserJohaan
- 9,028
- 20
- 112
- 199
11
votes
3 answers
Which one is faster ? Function call or Conditional if Statement?
Please consider the branch prediction too before answering this question.
I have some scenarios where i can replace a conditional statement with a call to a function with the help of function pointer.Some thing like this. (you can think of component…

Ayyappa
- 1,876
- 1
- 21
- 41
11
votes
2 answers
Understanding std::transform and how to beat it
I am trying to understand data-oriented design on a simple, specific problem. Apologies in advance to data-oriented design people, if I am doing something very stupid, but I am having a hard time understanding why and where my reasoning…

Arda Aytekin
- 1,231
- 14
- 24
11
votes
6 answers
If-statement vs function pointer
The goal is to change the behaviour in an event loop, depending on whether a checkbox is toggled on or off. The simplest way, that I can think of, is just to test the checkbox state each time the loop is run.
// if-statement
void action() { /* ...…

Davorin
- 1,160
- 15
- 31
10
votes
2 answers
What are the disadvantages of the ECS (Entity-Component-System) architectural pattern, compared to OOP (or other paradigms)?
Because of Unity ECS, I've been reading a lot about ECS lately.
There are many obvious advantages to an ECS architecture:
ECS is data-oriented: Data tends to be stored linearly, which is the most optimal way for the system to access it. In decent…

CosmicGiant
- 6,275
- 5
- 43
- 58
10
votes
1 answer
Switching back and forth between Array of Structures (AoS) and Structure of Arrays (SoA)
One feature that plays a prominent role in many of the writings on data oriented design is that there are many cases where rather than AoS (array of structs):
struct C_AoS {
int foo;
double bar;
};
std::vector cs;
...
std::cout <<…

alarge
- 2,162
- 2
- 13
- 14
9
votes
2 answers
C++ zero-cost abstraction for SoA/AoS memory layouts
Say I have a large code using Array of Structures (AoS) memory layout. I would like to build a zero-cost abstraction in C++ which allows me to switch between AoS and SoA with as little refactoring effort as possible.
For instance take a class with…

Paolo Crosetto
- 1,038
- 7
- 17
9
votes
2 answers
Object orientation, data orientation, cache pollution and cache obviousness
In a regular object oriented practice it is not that rare objects have multiple unrelated member properties. And when objects are being processed, it is not rare that it is done in different passes, which aim for different parts of their…

dtech
- 47,916
- 17
- 112
- 190