Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

of

Data oriented design and c++ Slide 1 Data oriented design and c++ Slide 2 Data oriented design and c++ Slide 3 Data oriented design and c++ Slide 4 Data oriented design and c++ Slide 5 Data oriented design and c++ Slide 6 Data oriented design and c++ Slide 7 Data oriented design and c++ Slide 8 Data oriented design and c++ Slide 9 Data oriented design and c++ Slide 10 Data oriented design and c++ Slide 11 Data oriented design and c++ Slide 12 Data oriented design and c++ Slide 13 Data oriented design and c++ Slide 14 Data oriented design and c++ Slide 15 Data oriented design and c++ Slide 16 Data oriented design and c++ Slide 17 Data oriented design and c++ Slide 18 Data oriented design and c++ Slide 19 Data oriented design and c++ Slide 20 Data oriented design and c++ Slide 21 Data oriented design and c++ Slide 22 Data oriented design and c++ Slide 23 Data oriented design and c++ Slide 24 Data oriented design and c++ Slide 25 Data oriented design and c++ Slide 26 Data oriented design and c++ Slide 27 Data oriented design and c++ Slide 28 Data oriented design and c++ Slide 29 Data oriented design and c++ Slide 30 Data oriented design and c++ Slide 31 Data oriented design and c++ Slide 32 Data oriented design and c++ Slide 33 Data oriented design and c++ Slide 34 Data oriented design and c++ Slide 35 Data oriented design and c++ Slide 36 Data oriented design and c++ Slide 37 Data oriented design and c++ Slide 38 Data oriented design and c++ Slide 39 Data oriented design and c++ Slide 40 Data oriented design and c++ Slide 41 Data oriented design and c++ Slide 42 Data oriented design and c++ Slide 43 Data oriented design and c++ Slide 44 Data oriented design and c++ Slide 45 Data oriented design and c++ Slide 46 Data oriented design and c++ Slide 47 Data oriented design and c++ Slide 48 Data oriented design and c++ Slide 49 Data oriented design and c++ Slide 50 Data oriented design and c++ Slide 51 Data oriented design and c++ Slide 52 Data oriented design and c++ Slide 53 Data oriented design and c++ Slide 54 Data oriented design and c++ Slide 55 Data oriented design and c++ Slide 56 Data oriented design and c++ Slide 57 Data oriented design and c++ Slide 58 Data oriented design and c++ Slide 59 Data oriented design and c++ Slide 60 Data oriented design and c++ Slide 61 Data oriented design and c++ Slide 62 Data oriented design and c++ Slide 63 Data oriented design and c++ Slide 64 Data oriented design and c++ Slide 65 Data oriented design and c++ Slide 66 Data oriented design and c++ Slide 67 Data oriented design and c++ Slide 68 Data oriented design and c++ Slide 69 Data oriented design and c++ Slide 70 Data oriented design and c++ Slide 71 Data oriented design and c++ Slide 72 Data oriented design and c++ Slide 73 Data oriented design and c++ Slide 74 Data oriented design and c++ Slide 75 Data oriented design and c++ Slide 76 Data oriented design and c++ Slide 77 Data oriented design and c++ Slide 78 Data oriented design and c++ Slide 79 Data oriented design and c++ Slide 80 Data oriented design and c++ Slide 81 Data oriented design and c++ Slide 82 Data oriented design and c++ Slide 83 Data oriented design and c++ Slide 84 Data oriented design and c++ Slide 85 Data oriented design and c++ Slide 86 Data oriented design and c++ Slide 87 Data oriented design and c++ Slide 88 Data oriented design and c++ Slide 89 Data oriented design and c++ Slide 90 Data oriented design and c++ Slide 91 Data oriented design and c++ Slide 92 Data oriented design and c++ Slide 93 Data oriented design and c++ Slide 94 Data oriented design and c++ Slide 95 Data oriented design and c++ Slide 96 Data oriented design and c++ Slide 97 Data oriented design and c++ Slide 98 Data oriented design and c++ Slide 99 Data oriented design and c++ Slide 100 Data oriented design and c++ Slide 101 Data oriented design and c++ Slide 102 Data oriented design and c++ Slide 103 Data oriented design and c++ Slide 104 Data oriented design and c++ Slide 105 Data oriented design and c++ Slide 106 Data oriented design and c++ Slide 107 Data oriented design and c++ Slide 108 Data oriented design and c++ Slide 109 Data oriented design and c++ Slide 110 Data oriented design and c++ Slide 111 Data oriented design and c++ Slide 112 Data oriented design and c++ Slide 113 Data oriented design and c++ Slide 114 Data oriented design and c++ Slide 115 Data oriented design and c++ Slide 116 Data oriented design and c++ Slide 117 Data oriented design and c++ Slide 118 Data oriented design and c++ Slide 119 Data oriented design and c++ Slide 120 Data oriented design and c++ Slide 121 Data oriented design and c++ Slide 122 Data oriented design and c++ Slide 123 Data oriented design and c++ Slide 124 Data oriented design and c++ Slide 125 Data oriented design and c++ Slide 126 Data oriented design and c++ Slide 127 Data oriented design and c++ Slide 128 Data oriented design and c++ Slide 129 Data oriented design and c++ Slide 130 Data oriented design and c++ Slide 131 Data oriented design and c++ Slide 132 Data oriented design and c++ Slide 133 Data oriented design and c++ Slide 134 Data oriented design and c++ Slide 135 Data oriented design and c++ Slide 136 Data oriented design and c++ Slide 137 Data oriented design and c++ Slide 138 Data oriented design and c++ Slide 139 Data oriented design and c++ Slide 140 Data oriented design and c++ Slide 141 Data oriented design and c++ Slide 142 Data oriented design and c++ Slide 143 Data oriented design and c++ Slide 144 Data oriented design and c++ Slide 145 Data oriented design and c++ Slide 146 Data oriented design and c++ Slide 147 Data oriented design and c++ Slide 148 Data oriented design and c++ Slide 149 Data oriented design and c++ Slide 150 Data oriented design and c++ Slide 151 Data oriented design and c++ Slide 152 Data oriented design and c++ Slide 153 Data oriented design and c++ Slide 154 Data oriented design and c++ Slide 155 Data oriented design and c++ Slide 156 Data oriented design and c++ Slide 157 Data oriented design and c++ Slide 158 Data oriented design and c++ Slide 159 Data oriented design and c++ Slide 160 Data oriented design and c++ Slide 161 Data oriented design and c++ Slide 162 Data oriented design and c++ Slide 163 Data oriented design and c++ Slide 164 Data oriented design and c++ Slide 165 Data oriented design and c++ Slide 166 Data oriented design and c++ Slide 167 Data oriented design and c++ Slide 168 Data oriented design and c++ Slide 169 Data oriented design and c++ Slide 170 Data oriented design and c++ Slide 171 Data oriented design and c++ Slide 172 Data oriented design and c++ Slide 173 Data oriented design and c++ Slide 174 Data oriented design and c++ Slide 175 Data oriented design and c++ Slide 176 Data oriented design and c++ Slide 177 Data oriented design and c++ Slide 178 Data oriented design and c++ Slide 179 Data oriented design and c++ Slide 180 Data oriented design and c++ Slide 181 Data oriented design and c++ Slide 182 Data oriented design and c++ Slide 183 Data oriented design and c++ Slide 184 Data oriented design and c++ Slide 185 Data oriented design and c++ Slide 186 Data oriented design and c++ Slide 187 Data oriented design and c++ Slide 188 Data oriented design and c++ Slide 189 Data oriented design and c++ Slide 190 Data oriented design and c++ Slide 191 Data oriented design and c++ Slide 192 Data oriented design and c++ Slide 193 Data oriented design and c++ Slide 194 Data oriented design and c++ Slide 195 Data oriented design and c++ Slide 196 Data oriented design and c++ Slide 197 Data oriented design and c++ Slide 198 Data oriented design and c++ Slide 199 Data oriented design and c++ Slide 200 Data oriented design and c++ Slide 201
Upcoming SlideShare
Great management of technical leads
Next
Download to read offline and view in fullscreen.

58 Likes

Share

Download to read offline

Data oriented design and c++

Download to read offline

cppcon keynote

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Data oriented design and c++

  1. 1. Data-Oriented Design and C++ Mike Acton Engine Director, Insomniac Games @mike_acton
  2. 2. A bit of background…
  3. 3. What does an “Engine” team do?
  4. 4. Runtime systems e.g. • Rendering • Animation and gestures • Streaming • Cinematics • VFX • Post-FX • Navigation • Localization • …many, many more!
  5. 5. Development tools e.g. • Level creation • Lighting • Material editing • VFX creation • Animation/state machine editing • Visual scripting • Scene painting • Cinematics creation • …many, many more!
  6. 6. What’s important to us?
  7. 7. What’s important to us? • Hard deadlines
  8. 8. What’s important to us? • Hard deadlines • Soft realtime performance requirements (Soft=33ms)
  9. 9. What’s important to us? • Hard deadlines • Soft realtime performance requirements (Soft=33ms) • Usability
  10. 10. What’s important to us? • Hard deadlines • Soft realtime performance requirements (Soft=33ms) • Usability • Performance
  11. 11. What’s important to us? • Hard deadlines • Soft realtime performance requirements (Soft=33ms) • Usability • Performance • Maintenance
  12. 12. What’s important to us? • Hard deadlines • Soft realtime performance requirements (Soft=33ms) • Usability • Performance • Maintenance • Debugability
  13. 13. What languages do we use…?
  14. 14. What languages do we use…? • C • C++ • Asm • Perl • Javascript • C#
  15. 15. What languages do we use…? • C • C++  ~70% • Asm • Perl • Javascript • C#
  16. 16. What languages do we use…? • C • C++  ~70% • Asm • Perl • Javascript • C# • Pixel shaders, vertex shaders, geometry shaders, compute shaders, …
  17. 17. We don’t make games for Mars but…
  18. 18. How are games like the Mars rovers?
  19. 19. How are games like the Mars rovers? •Exceptions
  20. 20. How are games like the Mars rovers? •Exceptions •Templates
  21. 21. How are games like the Mars rovers? •Exceptions •Templates • Iostream
  22. 22. How are games like the Mars rovers? •Exceptions •Templates • Iostream • Multiple inheritance
  23. 23. How are games like the Mars rovers? •Exceptions •Templates • Iostream • Multiple inheritance •Operator overloading
  24. 24. How are games like the Mars rovers? •Exceptions •Templates • Iostream • Multiple inheritance •Operator overloading •RTTI
  25. 25. How are games like the Mars rovers? •No STL
  26. 26. How are games like the Mars rovers? •No STL •Custom allocators (lots)
  27. 27. How are games like the Mars rovers? •No STL •Custom allocators (lots) •Custom debugging tools
  28. 28. Is data-oriented even a thing…?
  29. 29. Data-Oriented Design Principles The purpose of all programs, and all parts of those programs, is to transform data from one form to another.
  30. 30. Data-Oriented Design Principles If you don’t understand the data you don’t understand the problem.
  31. 31. Data-Oriented Design Principles Conversely, understand the problem by understanding the data.
  32. 32. Data-Oriented Design Principles Different problems require different solutions.
  33. 33. Data-Oriented Design Principles If you have different data, you have a different problem.
  34. 34. Data-Oriented Design Principles If you don’t understand the cost of solving the problem, you don’t understand the problem.
  35. 35. Data-Oriented Design Principles If you don’t understand the hardware, you can’t reason about the cost of solving the problem.
  36. 36. Data-Oriented Design Principles Everything is a data problem. Including usability, maintenance, debug-ability, etc. Everything.
  37. 37. Data-Oriented Design Principles Solving problems you probably don’t have creates more problems you definitely do.
  38. 38. Data-Oriented Design Principles Latency and throughput are only the same in sequential systems.
  39. 39. Data-Oriented Design Principles Latency and throughput are only the same in sequential systems.
  40. 40. Data-Oriented Design Principles Rule of thumb: Where there is one, there are many. Try looking on the time axis.
  41. 41. Data-Oriented Design Principles Rule of thumb: The more context you have, the better you can make the solution. Don’t throw away data you need.
  42. 42. Data-Oriented Design Principles Rule of thumb: NUMA extends to I/O and pre-built data all the way back through time to original source creation.
  43. 43. Data-Oriented Design Principles Software does not run in a magic fairy aether powered by the fevered dreams of CS PhDs.
  44. 44. Is data-oriented even a thing…? …certainly not new ideas. …more of a reminder of first principles.
  45. 45. …but it is a response to the culture of C++
  46. 46. …but it is a response to the culture of C++ …and The Three Big Lies it has engendered
  47. 47. i.e. Programmer’s job is NOT to write code; Programmer’s job is to solve (data transformation) problems
  48. 48. A simple example…
  49. 49. Solve for the most common case first, Not the most generic.
  50. 50. “Can’t the compiler do it?”
  51. 51. A little review…
  52. 52. (AMD Piledriver) http://www.agner.org/optimize/instruction_tables.pdf
  53. 53. (AMD Piledriver) http://www.agner.org/optimize/instruction_tables.pdf
  54. 54. http://research.scee.net/files/presentations/gcapaustralia09/Pitfalls_of_Object_Oriented_Programming_GCAP_09.pdf
  55. 55. http://www.gameenginebook.com/SINFO.pdf
  56. 56. The Battle of North Bridge L1 L2 RAM
  57. 57. L2 cache misses/frame (Most significant component)
  58. 58. Not even including shared memory modes… Name GPU-visible Cached GPU Coherent Heap-cacheable No Yes No Heap-write-combined No No No Physical-uncached ? No No GPU-write-combined Yes No No GPU-write-combined-read-only Yes No No GPU-cacheable Yes Yes Yes GPU-cacheable-noncoherent-RO Yes Yes No Command-write-combined No No No Command-cacheable No Yes Yes
  59. 59. http://deplinenoise.wordpress.com/2013/12/28/optimizable-code/
  60. 60. 2 x 32bit read; same cache line = ~200
  61. 61. Float mul, add = ~10
  62. 62. Let’s assume callq is replaced. Sqrt = ~30
  63. 63. Mul back to same addr; in L1; = ~3
  64. 64. Read+add from new line = ~200
  65. 65. Time spent waiting for L2 vs. actual work ~10:1
  66. 66. Time spent waiting for L2 vs. actual work ~10:1 This is the compiler’s space.
  67. 67. Time spent waiting for L2 vs. actual work ~10:1 This is the compiler’s space.
  68. 68. Compiler cannot solve the most significant problems.
  69. 69. Today’s subject: The 90% of problem space we need to solve that the compiler cannot. (And how we can help it with the 10% that it can.)
  70. 70. Simple, obvious things to look for + Back of the envelope calculations = Substantial wins
  71. 71. L2 cache misses/frame (Don’t waste them!)
  72. 72. Waste 56 bytes / 64 bytes
  73. 73. Waste 60 bytes / 64 bytes
  74. 74. 90% waste!
  75. 75. Alternatively, Only 10% capacity used* * Not the same as “used well”, but we’ll start here.
  76. 76. 12 bytes x count(5) = 72
  77. 77. 12 bytes x count(5) = 72 4 bytes x count(5) = 20
  78. 78. 12 bytes x count(32) = 384 = 64 x 6 4 bytes x count(32) = 128 = 64 x 2
  79. 79. 12 bytes x count(32) = 384 = 64 x 6 4 bytes x count(32) = 128 = 64 x 2 (6/32) = ~5.33 loop/cache line
  80. 80. 12 bytes x count(32) = 384 = 64 x 6 4 bytes x count(32) = 128 = 64 x 2 (6/32) = ~5.33 loop/cache line Sqrt + math = ~40 x 5.33 = 213.33 cycles/cache line
  81. 81. 12 bytes x count(32) = 384 = 64 x 6 4 bytes x count(32) = 128 = 64 x 2 (6/32) = ~5.33 loop/cache line Sqrt + math = ~40 x 5.33 = 213.33 cycles/cache line + streaming prefetch bonus
  82. 82. 12 bytes x count(32) = 384 = 64 x 6 4 bytes x count(32) = 128 = 64 x 2 (6/32) = ~5.33 loop/cache line Sqrt + math = ~40 x 5.33 = 213.33 cycles/cache line + streaming prefetch bonus Using cache line to capacity* = 10x speedup * Used. Still not necessarily as efficiently as possible
  83. 83. In addition… 1. Code is maintainable 2. Code is debugable 3. Can REASON about cost of change (6/32) = ~5.33 loop/cache line Sqrt + math = ~40 x 5.33 = 213.33 cycles/cache line + streaming prefetch bonus
  84. 84. In addition… 1. Code is maintainable 2. Code is debugable 3. Can REASON about cost of change Ignoring inconvenient facts is not engineering; It’s dogma. (6/32) = ~5.33 loop/cache line Sqrt + math = ~40 x 5.33 = 213.33 cycles/cache line + streaming prefetch bonus
  85. 85. bools in structs… (3) Extremely low information density
  86. 86. bools in structs… (3) Extremely low information density How big is your cache line?
  87. 87. bools in structs… (3) Extremely low information density How big is your cache line? What’s the most commonly accessed data? 64b?
  88. 88. How is it used? What does it generate? (2) Bools and last-minute decision making
  89. 89. MSVC
  90. 90. MSVC Re-read and re-test… Increment and loop…
  91. 91. Re-read and re-test… Increment and loop… Why? Super-conservative aliasing rules…? Member value might change?
  92. 92. What about something more aggressive…?
  93. 93. Test once and return… What about something more aggressive…?
  94. 94. Okay, so what about…
  95. 95. …well at least it inlined it?
  96. 96. MSVC doesn’t fare any better…
  97. 97. (4) Ghost reads and writes Don’t re-read member values or re-call functions when you already have the data.
  98. 98. BAM!
  99. 99. :(
  100. 100. (4) Ghost reads and writes Don’t re-read member values or re-call functions when you already have the data. Hoist all loop-invariant reads and branches. Even super-obvious ones that should already be in registers.
  101. 101. :)
  102. 102. :) A bit of unnecessary branching, but more-or-less equivalent.
  103. 103. (4) Ghost reads and writes Don’t re-read member values or re-call functions when you already have the data. Hoist all loop-invariant reads and branches. Even super-obvious ones that should already be in registers. Applies to any member fields especially. (Not particular to bools)
  104. 104. (3) Extremely low information density
  105. 105. (3) Extremely low information density What is the information density for is_spawn over time?
  106. 106. (3) Extremely low information density What is the information density for is_spawn over time? The easy way.
  107. 107. Zip the output 10,000 frames = 915 bytes = (915*8)/10,000 = 0.732 bits/frame
  108. 108. Zip the output 10,000 frames = 915 bytes = (915*8)/10,000 = 0.732 bits/frame Alternatively, Calculate Shannon Entropy:
  109. 109. (3) Extremely low information density What does that tell us?
  110. 110. (3) Extremely low information density What does that tell us? Figure (~2 L2 misses each frame ) x 10,000 If each cache line = 64b, 128b x 10,000 = 1,280,000 bytes
  111. 111. (3) Extremely low information density What does that tell us? Figure (~2 L2 misses each frame ) x 10,000 If each cache line = 64b, 128b x 10,000 = 1,280,000 bytes If avg information content = 0.732bits/frame X 10,000 = 7320 bits / 8 = 915 bytes
  112. 112. (3) Extremely low information density What does that tell us? Figure (~2 L2 misses each frame ) x 10,000 If each cache line = 64b, 128b x 10,000 = 1,280,000 bytes If avg information content = 0.732bits/frame X 10,000 = 7320 bits / 8 = 915 bytes Percentage waste (Noise::Signal) = (1,280,000-915)/1,280,000
  113. 113. What’re the alternatives?
  114. 114. (1) Per-frame…
  115. 115. (1) Per-frame… (decision table) 1 of 512 (8*64) bits used…
  116. 116. (1) Per-frame… (decision table) 1 of 512 (8*64) bits used… (a) Make same decision x 512
  117. 117. (1) Per-frame… (decision table) 1 of 512 (8*64) bits used… (a) Make same decision x 512 (b) Combine with other reads / xforms
  118. 118. (1) Per-frame… (decision table) 1 of 512 (8*64) bits used… (a) Make same decision x 512 (b) Combine with other reads / xforms Generally simplest. - But things cannot exist in abstract bubble. - Will require context.
  119. 119. (2) Over-frames…
  120. 120. (2) Over-frames… i.e. Only read when needed
  121. 121. (2) Over-frames… i.e. Only read when needed e.g. Arrays of command buffers for future frames…
  122. 122. Let’s review some code…
  123. 123. http://yosoygames.com.ar/wp/2013/11/on-mike-actons-review-of-ogrenode-cpp/
  124. 124. (1) Can’t re-arrange memory (much) Limited by ABI Can’t limit unused reads Extra padding
  125. 125. (2) Bools and last-minute decision making
  126. 126. Are we done with the constructor? (5) Over-generalization
  127. 127. Are we done with the constructor? (5) Over-generalization Complex constructors tend to imply that… - Reads are unmanaged (one at a time…)
  128. 128. Are we done with the constructor? (5) Over-generalization Complex constructors tend to imply that… - Reads are unmanaged (one at a time…) - Unnecessary reads/writes in destructors
  129. 129. Are we done with the constructor? (5) Over-generalization Complex constructors tend to imply that… - Reads are unmanaged (one at a time…) - Unnecessary reads/writes in destructors - Unmanaged icache (i.e. virtuals) => unmanaged reads/writes
  130. 130. Are we done with the constructor? (5) Over-generalization Complex constructors tend to imply that… - Reads are unmanaged (one at a time…) - Unnecessary reads/writes in destructors - Unmanaged icache (i.e. virtuals) => unmanaged reads/writes - Unnecessarily complex state machines (back to bools) - E.g. 2^7 states
  131. 131. Are we done with the constructor? (5) Over-generalization Complex constructors tend to imply that… - Reads are unmanaged (one at a time…) - Unnecessary reads/writes in destructors - Unmanaged icache (i.e. virtuals) => unmanaged reads/writes - Unnecessarily complex state machines (back to bools) - E.g. 2^7 states Rule of thumb: Store each state type separately Store same states together (No state value needed)
  132. 132. Are we done with the constructor? (5) Over-generalization (6) Undefined or under-defined constraints
  133. 133. Are we done with the constructor? (5) Over-generalization (6) Undefined or under-defined constraints Imply more (wasted) reads because pretending you don’t know what it could be.
  134. 134. Are we done with the constructor? (5) Over-generalization (6) Undefined or under-defined constraints Imply more (wasted) reads because pretending you don’t know what it could be. e.g. Strings, generally. Filenames, in particular.
  135. 135. Are we done with the constructor? (5) Over-generalization (6) Undefined or under-defined constraints Imply more (wasted) reads because pretending you don’t know what it could be. e.g. Strings, generally. Filenames, in particular. Rule of thumb: The best code is code that doesn’t need to exist. Do it offline. Do it once. e.g. precompiled string hashes
  136. 136. Are we done with the constructor? (5) Over-generalization (6) Undefined or under-defined constraints (7) Over-solving (computing too much) Compiler doesn’t have enough context to know how to simplify your problems for you.
  137. 137. Are we done with the constructor? (5) Over-generalization (6) Undefined or under-defined constraints (7) Over-solving (computing too much) Compiler doesn’t have enough context to know how to simplify your problems for you. But you can make simple tools that do… - E.g. Premultiply matrices
  138. 138. Are we done with the constructor? (5) Over-generalization (6) Undefined or under-defined constraints (7) Over-solving (computing too much) Compiler doesn’t have enough context to know how to simplify your problems for you. But you can make simple tools that do… - E.g. Premultiply matrices Work with the (actual) data you have. - E.g. Sparse or affine matrices
  139. 139. How do we approach “fixing” it?
  140. 140. (2) Bools and last-minute decision making
  141. 141. Step 1: organize Separate states so you can reason about them
  142. 142. Step 1: organize Separate states so you can reason about them Step 2: triage What are the relative values of each case i.e. p(call) * count
  143. 143. Step 1: organize Separate states so you can reason about them Step 2: triage What are the relative values of each case i.e. p(call) * count e.g. in-game vs. in-editor
  144. 144. Step 1: organize Separate states so you can reason about them Step 2: triage What are the relative values of each case i.e. p(call) * count Step 3: reduce waste
  145. 145. (back of the envelope read cost) ~200 cycles x 2 x count
  146. 146. (back of the envelope read cost) ~200 cycles x 2 x count ~2.28 count per 200 cycles = ~88
  147. 147. (back of the envelope read cost) ~200 cycles x 2 x count ~2.28 count per 200 cycles = ~88 t = 2 * cross(q.xyz, v) v' = v + q.w * t + cross(q.xyz, t)
  148. 148. (back of the envelope read cost) ~200 cycles x 2 x count ~2.28 count per 200 cycles = ~88 t = 2 * cross(q.xyz, v) v' = v + q.w * t + cross(q.xyz, t) (close enough to dig in and measure)
  149. 149. Apply the same steps recursively…
  150. 150. Apply the same steps recursively… Step 1: organize Separate states so you can reason about them Root or not; Calling function with context can distinguish
  151. 151. Apply the same steps recursively… Step 1: organize Separate states so you can reason about them Root or not; Calling function with context can distinguish
  152. 152. Apply the same steps recursively… Step 1: organize Separate states so you can reason about them
  153. 153. Apply the same steps recursively… Step 1: organize Separate states so you can reason about them Can’t reason well about the cost from…
  154. 154. Step 1: organize Separate states so you can reason about them
  155. 155. Step 1: organize Separate states so you can reason about them Step 2: triage What are the relative values of each case i.e. p(call) * count Step 3: reduce waste
  156. 156. Good News: Most problems are easy to see.
  157. 157. Good News: Side-effect of solving the 90% well, compiler can solve the 10% better.
  158. 158. Good News: Organized data makes maintenance, debugging and concurrency much easier
  159. 159. Bad News: Good programming is hard. Bad programming is easy.
  160. 160. While we’re on the subject… DESIGN PATTERNS: http://realtimecollisiondetection.net/blog/?p=81 http://realtimecollisiondetection.net/blog/?p=44 “
  • ChristianDobrilaHjga

    Jan. 18, 2020
  • JohanDuToit13

    Nov. 10, 2019
  • kaballoloko

    Aug. 8, 2019
  • sangkikim9

    Apr. 29, 2019
  • penaz

    Mar. 9, 2019
  • ShaunChoe

    Nov. 5, 2018
  • GarrettBellomy

    May. 11, 2018
  • gougoubaba

    Nov. 18, 2017
  • BenoitFouletier

    Jun. 6, 2017
  • TrimikhaValentius

    May. 1, 2017
  • YiweiGu4

    Mar. 9, 2017
  • giacomomilano

    Dec. 26, 2016
  • StevenRadomski

    Aug. 1, 2016
  • cruxwang

    Apr. 28, 2016
  • prolog

    Dec. 12, 2015
  • artyomnagaytsev9

    Dec. 6, 2015
  • tomochika1985

    Nov. 21, 2015
  • Victusfate

    Nov. 11, 2015
  • mythii

    Oct. 25, 2015
  • arunvr

    Sep. 24, 2015

cppcon keynote

Views

Total views

31,590

On Slideshare

0

From embeds

0

Number of embeds

1,772

Actions

Downloads

522

Shares

0

Comments

0

Likes

58

×