Introduction to Data-Oriented Design
-
Upload
it-weekend -
Category
Technology
-
view
2.064 -
download
3
description
Transcript of Introduction to Data-Oriented Design
![Page 1: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/1.jpg)
Introduction toData-Oriented Design
@YaroslavBunyakSenior Software Engineer, SoftServe
![Page 2: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/2.jpg)
Programming, M**********rDo you speak it?
![Page 3: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/3.jpg)
Story
![Page 4: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/4.jpg)
Sieve of Eratosthenes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
![Page 5: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/5.jpg)
Sieve of Eratosthenes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
![Page 6: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/6.jpg)
Sieve of Eratosthenes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
![Page 7: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/7.jpg)
Sieve of Eratosthenes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
![Page 8: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/8.jpg)
Sieve of Eratosthenes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
![Page 9: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/9.jpg)
Sieve of Eratosthenes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
![Page 10: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/10.jpg)
Sieve of Eratosthenes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
![Page 11: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/11.jpg)
Sieve of Eratosthenes
![Page 12: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/12.jpg)
Sieve of Eratosthenes
Simple algorithm
![Page 13: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/13.jpg)
Sieve of Eratosthenes
Simple algorithm
Easy to implement
![Page 14: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/14.jpg)
Sieve of Eratosthenes
![Page 15: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/15.jpg)
Sieve of Eratosthenesint array[SIZE];
![Page 16: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/16.jpg)
Sieve of Eratosthenesint array[SIZE];
array[i] = 1;
![Page 17: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/17.jpg)
Sieve of Eratosthenesint array[SIZE];
array[i] = 1;
if (array[i]) ...
![Page 18: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/18.jpg)
Sieve of Eratosthenesint array[SIZE];
array[i] = 1;
if (array[i]) ...
![Page 19: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/19.jpg)
Sieve of Eratosthenesint array[SIZE];
array[i] = 1;
if (array[i]) ...
int bits[SIZE / 32];
![Page 20: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/20.jpg)
Sieve of Eratosthenesint array[SIZE];
array[i] = 1;
if (array[i]) ...
int bits[SIZE / 32];
bits[i / 32] |= 1 << (i % 32);
![Page 21: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/21.jpg)
Sieve of Eratosthenesint array[SIZE];
array[i] = 1;
if (array[i]) ...
int bits[SIZE / 32];
bits[i / 32] |= 1 << (i % 32);
if (bits[i / 32] & (1 << (i % 32))) ...
![Page 22: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/22.jpg)
Sieve of Eratosthenes
![Page 23: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/23.jpg)
Sieve of Eratosthenes
Simple algorithm
![Page 24: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/24.jpg)
Sieve of Eratosthenes
Simple algorithm
Easy to implement
![Page 25: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/25.jpg)
Sieve of Eratosthenes
Simple algorithm
Easy to implement
But...
![Page 26: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/26.jpg)
Sieve of Eratosthenes
Simple algorithm
Easy to implement
But...
unexpected results
![Page 27: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/27.jpg)
Sieve of Eratosthenes
![Page 28: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/28.jpg)
Sieve of Eratosthenes
The second implementation (bitset) is 3-5x faster than first (array)
![Page 29: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/29.jpg)
Sieve of Eratosthenes
The second implementation (bitset) is 3-5x faster than first (array)
Even though it actually does more work
![Page 30: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/30.jpg)
Why?!.
![Page 31: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/31.jpg)
Fast Forward
![Page 32: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/32.jpg)
...
![Page 33: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/33.jpg)
...
• Years have passed
![Page 34: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/34.jpg)
...
• Years have passed
• I become a software engineer
![Page 35: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/35.jpg)
...
• Years have passed
• I become a software engineer
• And one day...
![Page 36: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/36.jpg)
This Graph
Slide 17
CPU/Memory performance
Computer architecture: a quantitative approachBy John L. Hennessy, David A. Patterson, Andrea C. Arpaci-Dusseau
![Page 37: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/37.jpg)
This Table1980 Modern PC Improvement, %
Clock speed, Mhz 6 3000 +500x
Memory size, MB 2 2000 +1000x
Memory bandwidth, MB/s 137000 (read)2000 (write)
+540x+150x
Memory latency, ns 225 ~70 +3x
Memory latency, cycles 1.4 210 -150x
![Page 38: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/38.jpg)
Our Programming Model
![Page 39: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/39.jpg)
Our Programming Model
• High-level languages
![Page 40: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/40.jpg)
Our Programming Model
• High-level languages
• OOP
![Page 41: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/41.jpg)
Our Programming Model
• High-level languages
• OOP
• everywhere!
![Page 42: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/42.jpg)
Our Programming Model
• High-level languages
• OOP
• everywhere!
• objects scattered throughout the address space
![Page 43: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/43.jpg)
Our Programming Model
• High-level languages
• OOP
• everywhere!
• objects scattered throughout the address space
• access patterns are unpredictable
![Page 44: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/44.jpg)
MeetData-Oriented Design
![Page 45: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/45.jpg)
Ideas
![Page 46: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/46.jpg)
Ideas
• Programs transform data
![Page 47: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/47.jpg)
Ideas
• Programs transform data
• nothing more
![Page 48: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/48.jpg)
Ideas
• Programs transform data
• nothing more
• Think about data, not code
![Page 49: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/49.jpg)
Ideas
• Programs transform data
• nothing more
• Think about data, not code
• Hardware is not a black box
![Page 50: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/50.jpg)
Program
data dataxform
![Page 51: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/51.jpg)
Program
data dataxform
Your Program
![Page 52: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/52.jpg)
Claim
• Memory latency is the king
• CPU cycles almost free
![Page 53: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/53.jpg)
Memory
![Page 54: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/54.jpg)
• CPU registers
MemoryCPU
![Page 55: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/55.jpg)
• CPU registers
• Cache Level 1
MemoryCPU
L1iCache
L1dCache
![Page 56: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/56.jpg)
• CPU registers
• Cache Level 1
• Cache Level 2
MemoryCPU
L1iCache
L1dCache
L2Cache
![Page 57: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/57.jpg)
• CPU registers
• Cache Level 1
• Cache Level 2
• RAM
MemoryCPU
RAM
L1iCache
L1dCache
L2Cache
![Page 58: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/58.jpg)
• CPU registers
• Cache Level 1
• Cache Level 2
• RAM
• HDD
MemoryCPU
RAM
Disk
L1iCache
L1dCache
L2Cache
![Page 59: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/59.jpg)
Distance Metaphor
![Page 60: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/60.jpg)
Distance Metaphor
• L1 cache: it's on your desk, pick it up.
![Page 61: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/61.jpg)
Distance Metaphor
• L1 cache: it's on your desk, pick it up.
• L2 cache: it's on the bookshelf in your office, get up out of the chair.
![Page 62: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/62.jpg)
Distance Metaphor
• L1 cache: it's on your desk, pick it up.
• L2 cache: it's on the bookshelf in your office, get up out of the chair.
• Main memory: it's on the shelf in your garage downstairs, might as well get a snack while you're down there.
![Page 63: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/63.jpg)
Distance Metaphor
• L1 cache: it's on your desk, pick it up.
• L2 cache: it's on the bookshelf in your office, get up out of the chair.
• Main memory: it's on the shelf in your garage downstairs, might as well get a snack while you're down there.
• Disk: it's in, um, California. Walk there. Walk back. Really.
![Page 64: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/64.jpg)
Distance Metaphor
• L1 cache: it's on your desk, pick it up.
• L2 cache: it's on the bookshelf in your office, get up out of the chair.
• Main memory: it's on the shelf in your garage downstairs, might as well get a snack while you're down there.
• Disk: it's in, um, California. Walk there. Walk back. Really.
http://hacksoflife.blogspot.com/2011/04/going-to-california-with-aching-in-my.html
![Page 65: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/65.jpg)
Advice
![Page 66: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/66.jpg)
Advice
• Keep your data closer to registers and cache
![Page 67: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/67.jpg)
Advice
• Keep your data closer to registers and cache
• What’s good for memory - good for you
![Page 68: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/68.jpg)
Example 1: AoS vs SoAstruct Tile
{
bool ready;
Data pixels; // big chunk of data
};
Tile tiles[SIZE];
vs
struct Image
{
bool ready[SIZE]; // hot data
Data pixels[SIZE]; // cold data
};
![Page 69: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/69.jpg)
Example 1: AoS vs SoAfor (int i = 0; i < SIZE; ++i)
{
if (tiles[i].ready)
draw(tiles[i].pixels);
}
vs
for (int i = 0; i < SIZE; ++i)
{
if (image.ready[i])
draw(image.pixels[i]);
}
![Page 70: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/70.jpg)
Example 1: AoS vs SoA
vs
![Page 71: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/71.jpg)
Example 2: Existencestruct Image
{
bool ready[SIZE];
Data pixels[SIZE];
};
Image image;
vs
Data ready_pixels[N];
Data no_pixels[M];
// N + M = SIZE
![Page 72: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/72.jpg)
Example 2: Existencefor (int i = 0; i < SIZE; ++i)
{
if (image.ready[i])
draw(image.pixels[i]);
}
vs
for (int i = 0; i < N; ++i)
{
draw(ready_pixels[i];
}
![Page 73: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/73.jpg)
Example 3: Locality
std::vector<float> numbers;
float sum = 0.0f;
for (auto it : numbers)
sum += *it;
vs
std::list<float> numbers;
float sum = 0.0f;
for (auto it : numbers)
sum+ = *it;
![Page 74: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/74.jpg)
Example 3: Locality
vs
![Page 75: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/75.jpg)
Few Patterns
• A to B transform
• In place transform
• Existence based processing
• Data normalization
• DB design says hello!
• Task, gather, dispatch, and more...
![Page 76: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/76.jpg)
Benefits of DOD
![Page 77: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/77.jpg)
Benefits of DOD
• Maximum performance
• CPU doesn’t wait & starve
![Page 78: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/78.jpg)
Benefits of DOD
• Maximum performance
• CPU doesn’t wait & starve
• Easy to parallelize
• data is grouped, transforms separated
• ready for Parallel Processing, OOP doesn’t
![Page 79: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/79.jpg)
Benefits of DOD
• Maximum performance
• CPU doesn’t wait & starve
• Easy to parallelize
• data is grouped, transforms separated
• ready for Parallel Processing, OOP doesn’t
• Simpler code
• surprise!
![Page 80: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/80.jpg)
References: Memory
• Ulrich Drepper “What Every Computer Programmer Should Know About Memory”
• Крис Касперски “Техника оптимизации програм. Еффективное использование памяти”
• Christer Ericson “Memory Optimization”
• Igor Ostrovsky “Gallery of Processor Cache Effects”
![Page 81: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/81.jpg)
References: DOD
• Noel Llopis “Data-Oriented Design”, Game Developer Magazine, September 2009
• Richard Fabian “Data-Oriented Desing”, book draft http://www.dataorienteddesign.com/dodmain/
• Tony Albrecht “Pitfalls of Object-Oriented Programming”
• Niklas Frykholm “Practical Examples of Data Oriented Design”
• Mike Acton “Typical C++ Bullshit”
• Data Oriented Design @ Google+
![Page 82: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/82.jpg)
Thank You!
![Page 83: Introduction to Data-Oriented Design](https://reader035.fdocuments.in/reader035/viewer/2022062303/554f890bb4c905d25b8b4e0c/html5/thumbnails/83.jpg)
Q?