- Not to be confused with Data-driven design.
In computing, data-oriented design is a program optimization approach motivated by cache coherency, used in video game development (usually in the programming languages C or C++). The approach is to focus on the data layout, separating and sorting fields according to when they are needed, and to think about transformations of data. Proponents include Mike Acton and Scott Meyers.
These methods became especially popular during the seventh generation of video game consoles that included PlayStation 3 (PS3) and Xbox 360, when the hazards of cache misses became especially pronounced, due to their use of in-order processors with high clock speeds and deep pipelines (some of the software issues were similar to those encountered on the Itanium, requiring loop unrolling for upfront scheduling). In modern systems (even with out of order execution), main memory is as many as hundreds of clock cycles away from the processing elements; consequently locality of reference issues dominate performance, requiring improvement of memory access patterns to fix. Game consoles often have relatively weak central processing units (CPUs) to devote more power and transistor budget to the graphics processing units (GPUs). Thus, it is critical that CPU side code is efficient to avoid Von Neumann bottlenecking.
Contrast with object-orientation
The claim is that traditional object-oriented programming (OOP) design principles result in poor data locality, more so if runtime polymorphism (dynamic dispatch) is used (which is especially problematic on some processors). Although OOP does superficially seem to organise code around data, the practice is quite different. OOP is actually about organising source code around data types, rather than physically grouping individual fields and arrays in a format efficient for access by specific functions. It also often hides layout details under abstraction layers, while a data-oriented programmer wants to consider this first and foremost.
The experimental programming language JAI being developed by Jonathan Blow has explicit support for data-oriented design, while eschewing the traditional OOP paradigm. This is facilitated by being able to transparently move fields between records without extensive source code changes to functions using them (or without extensive boilerplate code to enable this), and by adding direct support for structure of arrays (SoA) data layout.
- "Data-oriented design" (PDF).
- "CppCon 2014: Mike Acton "Data-Oriented Design and C++"".
- "code::dive conference 2014 - Scott Meyers: Cpu Caches and Why You Care".
- "What's wrong with Object-Oriented Design? Where's the harm in it?".describes the problems with virtual function calls, e.g., i-cache misses
- "Data-oriented design - why you might be shooting yourself in the foot with OOP".
- "Data-oriented demo:SOA,composition".Demonstration of data-oriented and SOA features in the JAI language, also explaining the motives.