Professional Documents
Culture Documents
PDF Data Oriented Design Software Engineering For Limited Resources and Short Schedules 2Nd Edition Richard Fabian Ebook Full Chapter
PDF Data Oriented Design Software Engineering For Limited Resources and Short Schedules 2Nd Edition Richard Fabian Ebook Full Chapter
https://textbookfull.com/product/design-patterns-in-net-
core-3-reusable-approaches-in-c-and-f-for-object-oriented-
software-design-2nd-edition-dmitri-nesteruk/
https://textbookfull.com/product/head-first-design-patterns-
building-extensible-and-maintainable-object-oriented-
software-2nd-edition-eric-freeman/
https://textbookfull.com/product/design-patterns-in-modern-c-
reusable-approaches-for-object-oriented-software-design-1st-
edition-dmitri-nesteruk/
https://textbookfull.com/product/perspectives-on-data-science-
for-software-engineering-1st-edition-tim-menzies/
https://textbookfull.com/product/regression-analysis-and-its-
application-a-data-oriented-approach-first-edition-richard-f-
gunst/
https://textbookfull.com/product/scenario-focused-engineering-
design-and-innovation-for-software-engineers-1st-edition-austina-
de-bonte/
https://textbookfull.com/product/azure-data-factory-by-example-
practical-implementation-for-data-engineers-2nd-edition-richard-
swinbank/
https://textbookfull.com/product/making-embedded-systems-design-
patterns-for-great-software-2nd-edition-elecia-white/
Data-Oriented Design
Richard Fabian
October 8, 2018
Data oriented design by Richard Fabian
1 Data-Oriented Design 1
1.1 It’s all about the data . . . . . . . . . . . . . . . 2
1.2 Data is not the problem domain . . . . . . . . 5
1.3 Data and statistics . . . . . . . . . . . . . . . . 10
1.4 Data can change . . . . . . . . . . . . . . . . . 12
1.5 How is data formed? . . . . . . . . . . . . . . . 17
1.6 The framework . . . . . . . . . . . . . . . . . . . 20
1.7 Conclusions and takeaways . . . . . . . . . . . 24
2 Relational Databases 27
2.1 Complex state . . . . . . . . . . . . . . . . . . . 28
2.2 The framework . . . . . . . . . . . . . . . . . . . 29
2.3 Normalising your data . . . . . . . . . . . . . . 32
2.4 Normalisation . . . . . . . . . . . . . . . . . . . 36
2.5 Operations . . . . . . . . . . . . . . . . . . . . . 52
2.6 Summing up . . . . . . . . . . . . . . . . . . . . 54
2.7 Stream Processing . . . . . . . . . . . . . . . . 55
2.8 Why does database technology matter? . . . . 57
3 Existential Processing 59
3.1 Complexity . . . . . . . . . . . . . . . . . . . . . 60
3.2 Debugging . . . . . . . . . . . . . . . . . . . . . 62
3.3 Why use an if . . . . . . . . . . . . . . . . . . . 63
3.4 Types of processing . . . . . . . . . . . . . . . . 68
3.5 Don’t use booleans . . . . . . . . . . . . . . . . 71
3.6 Don’t use enums quite as much . . . . . . . . 77
3.7 Prelude to polymorphism . . . . . . . . . . . . 79
3.8 Dynamic runtime polymorphism . . . . . . . . 80
3.9 Event handling . . . . . . . . . . . . . . . . . . 84
6 Searching 121
6.1 Indexes . . . . . . . . . . . . . . . . . . . . . . . 121
6.2 Data-oriented Lookup . . . . . . . . . . . . . . 123
6.3 Finding low and high . . . . . . . . . . . . . . . 129
6.4 Finding random . . . . . . . . . . . . . . . . . . 131
7 Sorting 133
7.1 Do you need to? . . . . . . . . . . . . . . . . . . 133
7.2 Maintaining . . . . . . . . . . . . . . . . . . . . 136
7.3 Sorting for your platform . . . . . . . . . . . . . 137
8 Optimisations 143
8.1 When should we optimise? . . . . . . . . . . . 145
8.2 Feedback . . . . . . . . . . . . . . . . . . . . . . 146
8.3 A strategy . . . . . . . . . . . . . . . . . . . . . 150
8.4 Tables . . . . . . . . . . . . . . . . . . . . . . . . 155
8.5 Transforms . . . . . . . . . . . . . . . . . . . . . 160
8.6 Spatial sets . . . . . . . . . . . . . . . . . . . . . 162
8.7 Lazy evaluation . . . . . . . . . . . . . . . . . . 163
8.8 Necessity . . . . . . . . . . . . . . . . . . . . . . 164
8.9 Varying length sets . . . . . . . . . . . . . . . . 165
8.10 Joins as intersections . . . . . . . . . . . . . . 168
8.11 Data-driven techniques . . . . . . . . . . . . . 169
8.12 Structs of arrays . . . . . . . . . . . . . . . . . 170
10 Concurrency 193
10.1 Thread-safety . . . . . . . . . . . . . . . . . . . 194
10.2 Inherently concurrent . . . . . . . . . . . . . . 198
10.3 Gateways . . . . . . . . . . . . . . . . . . . . . . 199
12 In Practice 221
12.1 Data-manipulation . . . . . . . . . . . . . . . . 221
12.2 Game entities . . . . . . . . . . . . . . . . . . . 227
15 Hardware 277
15.1 Sequential data . . . . . . . . . . . . . . . . . . 279
15.2 Deep pipes . . . . . . . . . . . . . . . . . . . . . 281
15.3 Microcode . . . . . . . . . . . . . . . . . . . . . 284
15.4 SIMD . . . . . . . . . . . . . . . . . . . . . . . . 285
15.5 Predictability . . . . . . . . . . . . . . . . . . . . 286
15.6 How it works . . . . . . . . . . . . . . . . . . . . 287
16 Sourcecode 289
16.1 The basics . . . . . . . . . . . . . . . . . . . . . 289
16.2 Linked lists . . . . . . . . . . . . . . . . . . . . . 291
16.3 Branch prediction . . . . . . . . . . . . . . . . . 292
16.4 Cache size effect . . . . . . . . . . . . . . . . . . 293
16.5 False sharing . . . . . . . . . . . . . . . . . . . 293
16.6 Hot, cold, access . . . . . . . . . . . . . . . . . 295
16.7 Key lookup . . . . . . . . . . . . . . . . . . . . . 296
16.8 Matrix transpose . . . . . . . . . . . . . . . . . 299
16.9 Modifying memory . . . . . . . . . . . . . . . . 301
16.10 SIMD . . . . . . . . . . . . . . . . . . . . . . . . 302
16.11 Speculative waste . . . . . . . . . . . . . . . . . 305
16.12 Finite State Machines . . . . . . . . . . . . . . 307
Introduction
Data-Oriented Design
other than maybe the logic programming languages such as Prolog. The ex-
The time was right in 2009. The hardware was ripe for a
change in how to develop. Potentially very fast computers were
hindered by a hardware ignorant programming paradigm.
The way game programmers coded at the time made many
engine programmers weep. The times have changed. Many
mobile and desktop solutions now seem to need the data-
oriented design approach less, not because the machines are
better at mitigating an ineffective approach, but the games be-
ing designed are less demanding and less complex. The trend
for mobile seems to be moving to AAA development, which
should bring the return of a need for managing complexity
and getting the most out of the hardware.
Other than not having grids where they make sense, many
modern games also seem to carry instances for each and every
item in the game. An instance for each rather than a variable
storing the number of items. For some games this is an op-
timisation, as creation and destruction of objects is a costly
activity, but the trend is worrying, as these ways of storing
information about the world make the world impenetrable to
simple interrogation.