Or… Yet another privileged CIS white male in the AAA space talking about data.

148

Transcript of Or… Yet another privileged CIS white male in the AAA space talking about data.

Page 1: Or… Yet another privileged CIS white male in the AAA space talking about data.
Page 2: Or… Yet another privileged CIS white male in the AAA space talking about data.

Or…Yet another privileged CIS white male in the AAA space talking

about data.

Page 3: Or… Yet another privileged CIS white male in the AAA space talking about data.

What is good code?Our role is not to write "good" code. Our role is to solve our problems well.

With fixed hardware resources, that often means reducing waste or at least having the potential to reduce waste (i.e. optimizable) so that we can solve bigger and more interesting problems in the same space.

"Good" code in that context is the code that was written based on a rational and reasoned analysis of the actual problems that need solving, hardware resources, and available production time.

i.e. At the very least not using the "pull it out your ass" design method combined with a goal to "solve all problems for everyone, everywhere."

Page 4: Or… Yet another privileged CIS white male in the AAA space talking about data.

Can’t the compiler do it?

Page 5: Or… Yet another privileged CIS white male in the AAA space talking about data.

A little review…

Page 6: Or… Yet another privileged CIS white male in the AAA space talking about data.

http://www.agner.org/optimize/instruction_tables.pdf

(AMD Piledriver)

Page 7: Or… Yet another privileged CIS white male in the AAA space talking about data.

http://www.agner.org/optimize/instruction_tables.pdf

(AMD Piledriver)

Page 8: Or… Yet another privileged CIS white male in the AAA space talking about data.

http://research.scee.net/files/presentations/gcapaustralia09/Pitfalls_of_Object_Oriented_Programming_GCAP_09.pdf

Page 9: Or… Yet another privileged CIS white male in the AAA space talking about data.

http://www.gameenginebook.com/SINFO.pdf

Page 10: Or… Yet another privileged CIS white male in the AAA space talking about data.

The Battle of North Bridge

L1

L2

RAM

Page 11: Or… Yet another privileged CIS white male in the AAA space talking about data.

L2 cache misses/frame(Most significant component)

Page 12: Or… Yet another privileged CIS white male in the AAA space talking about data.

http://deplinenoise.wordpress.com/2013/12/28/optimizable-code/

Page 13: Or… Yet another privileged CIS white male in the AAA space talking about data.
Page 14: Or… Yet another privileged CIS white male in the AAA space talking about data.

2 x 32bit read; same cache line = ~200

Page 15: Or… Yet another privileged CIS white male in the AAA space talking about data.

Float mul, add = ~10

Page 16: Or… Yet another privileged CIS white male in the AAA space talking about data.

Let’s assume callq is replaced. Sqrt = ~30

Page 17: Or… Yet another privileged CIS white male in the AAA space talking about data.

Mul back to same addr; in L1; = ~3

Page 18: Or… Yet another privileged CIS white male in the AAA space talking about data.

Read+add from new line= ~200

Page 19: Or… Yet another privileged CIS white male in the AAA space talking about data.

Time spent waiting for L2 vs. actual work

~10:1

Page 20: Or… Yet another privileged CIS white male in the AAA space talking about data.

Time spent waiting for L2 vs. actual work

~10:1

This is the compiler’s space.

Page 21: Or… Yet another privileged CIS white male in the AAA space talking about data.

Time spent waiting for L2 vs. actual work

~10:1

This is the compiler’s space.

Page 22: Or… Yet another privileged CIS white male in the AAA space talking about data.

Compiler cannot solve the most significant problems.

Page 23: Or… Yet another privileged CIS white male in the AAA space talking about data.

See also:

https://plus.google.com/u/0/+Dataorienteddesign/posts

Page 24: Or… Yet another privileged CIS white male in the AAA space talking about data.

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.)

Page 25: Or… Yet another privileged CIS white male in the AAA space talking about data.

Simple, obvious things to look for + Back of the envelope

calculations = Substantial wins

Page 26: Or… Yet another privileged CIS white male in the AAA space talking about data.

What’s the most common cause of

waste?

Page 27: Or… Yet another privileged CIS white male in the AAA space talking about data.

What’s the cause?

http://www.insomniacgames.com/three-big-lies-typical-design-failures-in-game-programming-gdc10/

Page 28: Or… Yet another privileged CIS white male in the AAA space talking about data.
Page 29: Or… Yet another privileged CIS white male in the AAA space talking about data.

http://deplinenoise.wordpress.com/2013/12/28/optimizable-code/

So how do we solve for it?

Page 30: Or… Yet another privileged CIS white male in the AAA space talking about data.

L2 cache misses/frame(Don’t waste them!)

Page 31: Or… Yet another privileged CIS white male in the AAA space talking about data.

Waste 56 bytes / 64 bytes

Page 32: Or… Yet another privileged CIS white male in the AAA space talking about data.

Waste 60 bytes / 64 bytes

Page 33: Or… Yet another privileged CIS white male in the AAA space talking about data.

90% waste!

Page 34: Or… Yet another privileged CIS white male in the AAA space talking about data.

Alternatively,Only 10% capacity used*

* Not the same as “used well”, but we’ll start here.

Page 35: Or… Yet another privileged CIS white male in the AAA space talking about data.
Page 36: Or… Yet another privileged CIS white male in the AAA space talking about data.

12 bytes x count(5) = 72

Page 37: Or… Yet another privileged CIS white male in the AAA space talking about data.

12 bytes x count(5) = 72

4 bytes x count(5) = 20

Page 38: Or… Yet another privileged CIS white male in the AAA space talking about data.

12 bytes x count(32) = 384 = 64 x 6

4 bytes x count(32) = 128 = 64 x 2

Page 39: Or… Yet another privileged CIS white male in the AAA space talking about data.

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

Page 40: Or… Yet another privileged CIS white male in the AAA space talking about data.

12 bytes x count(32) = 384 = 64 x 6

4 bytes x count(32) = 128 = 64 x 2

Sqrt + math = ~40 x 5.33 = 213.33 cycles/cache line(6/32) = ~5.33 loop/cache line

Page 41: Or… Yet another privileged CIS white male in the AAA space talking about data.

12 bytes x count(32) = 384 = 64 x 6

4 bytes x count(32) = 128 = 64 x 2

Sqrt + math = ~40 x 5.33 = 213.33 cycles/cache line(6/32) = ~5.33 loop/cache line

+ streaming prefetch bonus

Page 42: Or… Yet another privileged CIS white male in the AAA space talking about data.

12 bytes x count(32) = 384 = 64 x 6

4 bytes x count(32) = 128 = 64 x 2

Sqrt + math = ~40 x 5.33 = 213.33 cycles/cache line(6/32) = ~5.33 loop/cache line

+ streaming prefetch bonus

Using cache line to capacity* =10x speedup

* Used. Still not necessarily as efficiently as possible

Page 43: Or… Yet another privileged CIS white male in the AAA space talking about data.

Sqrt + math = ~40 x 5.33 = 213.33 cycles/cache line(6/32) = ~5.33 loop/cache line

+ streaming prefetch bonus

In addition…1. Code is maintainable

2. Code is debugable3. Can REASON about cost of change

Page 44: Or… Yet another privileged CIS white male in the AAA space talking about data.

Sqrt + math = ~40 x 5.33 = 213.33 cycles/cache line(6/32) = ~5.33 loop/cache line

+ streaming prefetch bonus

In addition…1. Code is maintainable

2. Code is debugable3. Can REASON about cost of change

Ignoring inconvenient facts is not engineering;It’s dogma.

Page 45: Or… Yet another privileged CIS white male in the AAA space talking about data.

Let’s review some code…

Page 46: Or… Yet another privileged CIS white male in the AAA space talking about data.
Page 47: Or… Yet another privileged CIS white male in the AAA space talking about data.

http://yosoygames.com.ar/wp/2013/11/on-mike-actons-review-of-ogrenode-cpp/

Page 48: Or… Yet another privileged CIS white male in the AAA space talking about data.
Page 49: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Can’t re-arrange memory (much)

Limited by ABI

Can’t limit unused reads

Extra padding

Page 50: Or… Yet another privileged CIS white male in the AAA space talking about data.

http://stackoverflow.com/questions/916600/can-a-c-compiler-re-order-elements-in-a-struct

In theory…

Page 51: Or… Yet another privileged CIS white male in the AAA space talking about data.

In practice…

Page 52: Or… Yet another privileged CIS white male in the AAA space talking about data.

In practice…

Page 53: Or… Yet another privileged CIS white male in the AAA space talking about data.

(2) Bools and last-minute decision making

Page 54: Or… Yet another privileged CIS white male in the AAA space talking about data.

bools in structs… (3) Extremely low information density

Page 55: Or… Yet another privileged CIS white male in the AAA space talking about data.

bools in structs… (3) Extremely low information density

How big is your cache line?

Page 56: Or… Yet another privileged CIS white male in the AAA space talking about data.

bools in structs… (3) Extremely low information density

How big is your cache line?

What’s the most commonly accessed data?

64b?

Page 57: Or… Yet another privileged CIS white male in the AAA space talking about data.

(2) Bools and last-minute decision makingHow is it used? What does it generate?

Page 58: Or… Yet another privileged CIS white male in the AAA space talking about data.

MSVC

Page 59: Or… Yet another privileged CIS white male in the AAA space talking about data.

MSVC

Re-read and re-test…

Increment and loop…

Page 60: Or… Yet another privileged CIS white male in the AAA space talking about data.

Re-read and re-test…

Increment and loop…

Why?

Super-conservative aliasing rules…?Member value might change?

Page 61: Or… Yet another privileged CIS white male in the AAA space talking about data.

What about something more aggressive…?

Page 62: Or… Yet another privileged CIS white male in the AAA space talking about data.

Test once and return…

What about something more aggressive…?

Page 63: Or… Yet another privileged CIS white male in the AAA space talking about data.

Okay, so what about…

Page 64: Or… Yet another privileged CIS white male in the AAA space talking about data.

…well at least it inlined it?

Page 65: Or… Yet another privileged CIS white male in the AAA space talking about data.

MSVC doesn’t fare any better…

Page 66: Or… Yet another privileged CIS white male in the AAA space talking about data.

Don’t re-read member values or re-call functions whenyou already have the data.

(4) Ghost reads and writes

Page 67: Or… Yet another privileged CIS white male in the AAA space talking about data.

BAM!

Page 68: Or… Yet another privileged CIS white male in the AAA space talking about data.

:(

Page 69: Or… Yet another privileged CIS white male in the AAA space talking about data.

(4) Ghost reads and writes

Don’t re-read member values or re-call functions whenyou already have the data.

Hoist all loop-invariant reads and branches. Even super-obvious ones that should already be in registers.

Page 70: Or… Yet another privileged CIS white male in the AAA space talking about data.

:)

Page 71: Or… Yet another privileged CIS white male in the AAA space talking about data.

:)

A bit of unnecessary branching, but more-or-less equivalent.

Page 72: Or… Yet another privileged CIS white male in the AAA space talking about data.

Note I’m not picking on MSVC in particular. It’s an arbitrary example that could have gone either way for either compiler. The point to note is that all compilers are limited in their ability to reason about the problem and can’t solve nearly as sophisticated problems even within their space as people imagine.

Page 73: Or… Yet another privileged CIS white male in the AAA space talking about data.

(4) Ghost reads and writes

Don’t re-read member values or re-call functions whenyou 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)

Page 74: Or… Yet another privileged CIS white male in the AAA space talking about data.

The story so far… How can you help the compiler?

Page 75: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Can’t re-arrange memory (much)

The story so far… How can you help the compiler?

Page 76: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Can’t re-arrange memory (much)

Arrange memory by probability of access.

The story so far… How can you help the compiler?

Page 77: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Can’t re-arrange memory (much)

(2) Bools and last-minute decision making

The story so far… How can you help the compiler?

Page 78: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Can’t re-arrange memory (much)

(2) Bools and last-minute decision making

Hoist decision making to first-opportunity.

The story so far… How can you help the compiler?

Page 79: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Can’t re-arrange memory (much)

(2) Bools and last-minute decision making

(3) Extremely low information density

The story so far… How can you help the compiler?

Page 80: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Can’t re-arrange memory (much)

(2) Bools and last-minute decision making

(3) Extremely low information density

Maximize memory read value.

The story so far… How can you help the compiler?

Page 81: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Can’t re-arrange memory (much)

(2) Bools and last-minute decision making

(3) Extremely low information density

Maximize memory read value.

How can we measure this?

The story so far… How can you help the compiler?

Page 82: Or… Yet another privileged CIS white male in the AAA space talking about data.

(3) Extremely low information density

Page 83: Or… Yet another privileged CIS white male in the AAA space talking about data.

(3) Extremely low information density

What is the information density for is_spawnover time?

Page 84: Or… Yet another privileged CIS white male in the AAA space talking about data.

(3) Extremely low information density

What is the information density for is_spawnover time?

The easy way.

Page 85: Or… Yet another privileged CIS white male in the AAA space talking about data.
Page 86: Or… Yet another privileged CIS white male in the AAA space talking about data.

Zip the output10,000 frames= 915 bytes= (915*8)/10,000= 0.732 bits/frame

Page 87: Or… Yet another privileged CIS white male in the AAA space talking about data.

Zip the output10,000 frames= 915 bytes= (915*8)/10,000= 0.732 bits/frame

Alternatively,Calculate Shannon Entropy:

Page 88: Or… Yet another privileged CIS white male in the AAA space talking about data.

(3) Extremely low information density

What does that tell us?

Page 89: Or… Yet another privileged CIS white male in the AAA space talking about data.

(3) Extremely low information density

What does that tell us?

Figure (~2 L2 misses each frame ) x 10,000If each cache line = 64b,128b x 10,000 = 1,280,000 bytes

Page 90: Or… Yet another privileged CIS white male in the AAA space talking about data.

(3) Extremely low information density

What does that tell us?

Figure (~2 L2 misses each frame ) x 10,000If each cache line = 64b,128b x 10,000 = 1,280,000 bytes

If avg information content = 0.732bits/frameX 10,000 = 7320 bits/ 8 = 915 bytes

Page 91: Or… Yet another privileged CIS white male in the AAA space talking about data.

(3) Extremely low information density

What does that tell us?

Figure (~2 L2 misses each frame ) x 10,000If each cache line = 64b,128b x 10,000 = 1,280,000 bytes

If avg information content = 0.732bits/frameX 10,000 = 7320 bits/ 8 = 915 bytes

Percentage waste (Noise::Signal) =(1,280,000-915)/1,280,000

Page 92: Or… Yet another privileged CIS white male in the AAA space talking about data.

What’re the alternatives?

Page 93: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Per-frame…

Page 94: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Per-frame…

1 of 512 (8*64) bits used…

(decision table)

Page 95: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Per-frame…

1 of 512 (8*64) bits used…

(decision table)

(a) Make same decision x 512

Page 96: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Per-frame…

1 of 512 (8*64) bits used…

(decision table)

(a) Make same decision x 512

(b) Combine with other reads / xforms

Page 97: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Per-frame…

1 of 512 (8*64) bits used…

(decision table)

(a) Make same decision x 512

(b) Combine with other reads / xforms

Generally simplest. - But things cannot exist in abstract bubble.- Will require context.

Page 98: Or… Yet another privileged CIS white male in the AAA space talking about data.

(2) Over-frames…

Page 99: Or… Yet another privileged CIS white male in the AAA space talking about data.

(2) Over-frames…

i.e. Only read when needed

Page 100: Or… Yet another privileged CIS white male in the AAA space talking about data.

(2) Over-frames…

i.e. Only read when needed

e.g.

Arrays of command buffers for future frames…

Page 101: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Can’t re-arrange memory (much)

(2) Bools and last-minute decision making

(3) Extremely low information density

(Try it.)How can we measure this?

Maximize memory read value.

The story so far… How can you help the compiler?

Page 102: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Can’t re-arrange memory (much)

(2) Bools and last-minute decision making

(3) Extremely low information density

(Try it.)How can we measure this?

Maximize memory read value.

All these “code smells” can be viewed as symptoms of information density problems…

The story so far… How can you help the compiler?

Page 103: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Can’t re-arrange memory (much)

(2) Bools and last-minute decision making

(3) Extremely low information density

(4) Ghost reads and writes

The story so far… How can you help the compiler?

Page 104: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Can’t re-arrange memory (much)

(2) Bools and last-minute decision making

(3) Extremely low information density

(4) Ghost reads and writes

Don’t re-read member values or re-call functions whenyou already have the data.

The story so far… How can you help the compiler?

Page 105: Or… Yet another privileged CIS white male in the AAA space talking about data.

(1) Can’t re-arrange memory (much)

(2) Bools and last-minute decision making

(3) Extremely low information density

(4) Ghost reads and writes

The story so far… The compiler can’t help with:

Don’t re-read member values or re-call functions whenyou already have the data.

Easy to confuse compiler, even within the 10% space

The story so far… How can you help the compiler?

Page 106: Or… Yet another privileged CIS white male in the AAA space talking about data.

Are we done with the constructor?

Page 107: Or… Yet another privileged CIS white male in the AAA space talking about data.

Are we done with the constructor?

(5) Over-generalization

Page 108: Or… Yet another privileged CIS white male in the AAA space talking about data.

Are we done with the constructor?

(5) Over-generalization

Complex constructors tend to imply that…- Reads are unmanaged (one at a time…)

Page 109: Or… Yet another privileged CIS white male in the AAA space talking about data.

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

Page 110: Or… Yet another privileged CIS white male in the AAA space talking about data.

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

Page 111: Or… Yet another privileged CIS white male in the AAA space talking about data.

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

Page 112: Or… Yet another privileged CIS white male in the AAA space talking about data.

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)

Page 113: Or… Yet another privileged CIS white male in the AAA space talking about data.

Are we done with the constructor?

(5) Over-generalization

(6) Undefined or under-defined constraints

Page 114: Or… Yet another privileged CIS white male in the AAA space talking about data.

Are we done with the constructor?

(5) Over-generalization

(6) Undefined or under-defined constraints

Imply more (wasted) reads because pretending youdon’t know what it could be.

Page 115: Or… Yet another privileged CIS white male in the AAA space talking about data.

Are we done with the constructor?

(5) Over-generalization

(6) Undefined or under-defined constraints

Imply more (wasted) reads because pretending youdon’t know what it could be.

e.g. Strings, generally. Filenames, in particular.

Page 116: Or… Yet another privileged CIS white male in the AAA space talking about data.

Are we done with the constructor?

(5) Over-generalization

(6) Undefined or under-defined constraints

Imply more (wasted) reads because pretending youdon’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

Page 117: Or… Yet another privileged CIS white male in the AAA space talking about data.

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.

Page 118: Or… Yet another privileged CIS white male in the AAA space talking about data.

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

Page 119: Or… Yet another privileged CIS white male in the AAA space talking about data.

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

Page 120: Or… Yet another privileged CIS white male in the AAA space talking about data.

http://fgiesen.wordpress.com/2010/10/21/finish-your-derivations-please/

Is the compiler going to transform this…

Into this… for you?

Page 121: Or… Yet another privileged CIS white male in the AAA space talking about data.

http://realtimecollisiondetection.net/blog/?p=81

http://realtimecollisiondetection.net/blog/?p=44

While we’re on the subject…DESIGN PATTERNS:

Page 122: Or… Yet another privileged CIS white male in the AAA space talking about data.

Okay… Now a quick pass through some

other functions.

Page 123: Or… Yet another privileged CIS white male in the AAA space talking about data.
Page 124: Or… Yet another privileged CIS white male in the AAA space talking about data.

(2) Bools and last-minute decision making

Page 125: Or… Yet another privileged CIS white male in the AAA space talking about data.

Step 1: organizeSeparate states so you can reason about them

Page 126: Or… Yet another privileged CIS white male in the AAA space talking about data.

Step 1: organizeSeparate states so you can reason about them

Step 2: triageWhat are the relative values of each casei.e. p(call) * count

Page 127: Or… Yet another privileged CIS white male in the AAA space talking about data.

Step 1: organizeSeparate states so you can reason about them

Step 2: triageWhat are the relative values of each casei.e. p(call) * count

e.g. in-game vs. in-editor

Page 128: Or… Yet another privileged CIS white male in the AAA space talking about data.

Step 1: organizeSeparate states so you can reason about them

Step 2: triageWhat are the relative values of each casei.e. p(call) * count

Step 3: reduce waste

Page 129: Or… Yet another privileged CIS white male in the AAA space talking about data.

~200 cycles x 2 x count

(back of the envelope read cost)

Page 130: Or… Yet another privileged CIS white male in the AAA space talking about data.

~200 cycles x 2 x count

~2.28 count per 200 cycles= ~88

(back of the envelope read cost)

Page 131: Or… Yet another privileged CIS white male in the AAA space talking about data.

~200 cycles x 2 x count

~2.28 count per 200 cycles= ~88

(back of the envelope read cost)

t = 2 * cross(q.xyz, v)v' = v + q.w * t + cross(q.xyz, t)

Page 132: Or… Yet another privileged CIS white male in the AAA space talking about data.

~200 cycles x 2 x count

~2.28 count per 200 cycles= ~88

(back of the envelope read cost)

t = 2 * cross(q.xyz, v)v' = v + q.w * t + cross(q.xyz, t)

(close enough to dig in andmeasure)

Page 133: Or… Yet another privileged CIS white male in the AAA space talking about data.

Apply the same steps recursively…

Page 134: Or… Yet another privileged CIS white male in the AAA space talking about data.

Apply the same steps recursively…

Step 1: organizeSeparate states so you can reason about them

Root or not; Calling function with context can distinguish

Page 135: Or… Yet another privileged CIS white male in the AAA space talking about data.

Apply the same steps recursively…

Step 1: organizeSeparate states so you can reason about them

Root or not; Calling function with context can distinguish

Page 136: Or… Yet another privileged CIS white male in the AAA space talking about data.

Apply the same steps recursively…

Step 1: organizeSeparate states so you can reason about them

Page 137: Or… Yet another privileged CIS white male in the AAA space talking about data.

Apply the same steps recursively…

Step 1: organizeSeparate states so you can reason about them

Can’t reason well about the cost from…

Page 138: Or… Yet another privileged CIS white male in the AAA space talking about data.

Step 1: organizeSeparate states so you can reason about them

Page 139: Or… Yet another privileged CIS white male in the AAA space talking about data.

Step 1: organizeSeparate states so you can reason about them

Step 2: triageWhat are the relative values of each casei.e. p(call) * count

Step 3: reduce waste

Page 140: Or… Yet another privileged CIS white male in the AAA space talking about data.

And here…

Page 141: Or… Yet another privileged CIS white male in the AAA space talking about data.

Before we close, let’s revisit…

Page 142: Or… Yet another privileged CIS white male in the AAA space talking about data.

12 bytes x count(32) = 384 = 64 x 6

4 bytes x count(32) = 128 = 64 x 2

Page 143: Or… Yet another privileged CIS white male in the AAA space talking about data.

12 bytes x count(32) = 384 = 64 x 6

4 bytes x count(32) = 128 = 64 x 2

e.g. use zip trick to determine that information density of input is still pretty low…

Use knowledge of constraints (how fast can velocity be *really*?) to reduce further.

Page 144: Or… Yet another privileged CIS white male in the AAA space talking about data.

Good News:Most problems are

easy to see.

Page 145: Or… Yet another privileged CIS white male in the AAA space talking about data.

Good News:Side-effect of solving the 90% well, compiler can solve the

10% better.

Page 146: Or… Yet another privileged CIS white male in the AAA space talking about data.

Good News:Organized data makes

maintenance, debugging and concurrency much easier

Page 147: Or… Yet another privileged CIS white male in the AAA space talking about data.

Bad News:Good programming is hard.Bad programming is easy.

Page 148: Or… Yet another privileged CIS white male in the AAA space talking about data.

PS: Let’s get more women in tech