Skip to content

Commit a291c67

Browse files
committed
Fix link in Data Locality.
1 parent 1fa6b5f commit a291c67

File tree

2 files changed

+34
-36
lines changed

2 files changed

+34
-36
lines changed

book/data-locality.markdown

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88
## Motivation
99

10-
We've been lied to. They keep showing us charts where CPU speed goes up and up
11-
every year as if Moore's Law isn't just a historical observation but some kind
12-
of divine right. Without lifting a finger, we software folks watch our programs
10+
We've been lied to. They keep showing us charts where CPU speed goes up and up
11+
every year as if Moore's Law isn't just a historical observation but some kind
12+
of divine right. Without lifting a finger, we software folks watch our programs
1313
magically accelerate just by virtue of new hardware.
1414

15-
Chips *have* been getting faster (though even that's plateauing now), but the
16-
hardware heads failed to mention something. Sure, we can *process* data faster
15+
Chips *have* been getting faster (though even that's plateauing now), but the
16+
hardware heads failed to mention something. Sure, we can *process* data faster
1717
than ever, but we can't *get* that data faster.
1818

1919
<span name="legend"></span>
@@ -22,34 +22,34 @@ than ever, but we can't *get* that data faster.
2222

2323
<aside name="legend">
2424

25-
Processor and RAM speed relative to their respective speeds in 1980. As you can
25+
Processor and RAM speed relative to their respective speeds in 1980. As you can
2626
see, CPUs have grown in leaps and bounds, but RAM access is lagging far behind.
2727

2828
Data for this is from *Computer Architecture: A Quantitative Approach*
29-
by John L. Hennessy, David A. Patterson, Andrea C. Arpaci-Dusseau by way of Tony
29+
by John L. Hennessy, David A. Patterson, Andrea C. Arpaci-Dusseau by way of Tony
3030
Albrecht's "[Pitfalls of Object-Oriented Programming][poop]&rdquo;.
3131

3232
[poop]: http://seven-degrees-of-freedom.blogspot.com/2009/12/pitfalls-of-object-oriented-programming.html
3333

3434
</aside>
3535

36-
For your super-fast CPU to blow through a ream of calculations, it actually has
37-
to get the data out of main memory and into registers. As you can see, RAM hasn't
36+
For your super-fast CPU to blow through a ream of calculations, it actually has
37+
to get the data out of main memory and into registers. As you can see, RAM hasn't
3838
been keeping up with increasing CPU speeds. Not even close.
3939

40-
With today's hardware, it can take *hundreds* of cycles to fetch a byte of data
41-
from <span name="ram">RAM</span>. If most instructions need data, and it takes
42-
hundreds of cycles to get it, how is it that our CPUs aren't sitting idle 99%
40+
With today's hardware, it can take *hundreds* of cycles to fetch a byte of data
41+
from <span name="ram">RAM</span>. If most instructions need data, and it takes
42+
hundreds of cycles to get it, how is it that our CPUs aren't sitting idle 99%
4343
of the time waiting for data?
4444

45-
Actually, they *are* stuck waiting on memory an astonishingly large fraction of
46-
time these days, but it's not as bad as it could be. To explain how, let's take
45+
Actually, they *are* stuck waiting on memory an astonishingly large fraction of
46+
time these days, but it's not as bad as it could be. To explain how, let's take
4747
a trip to the Land of Overly Long Analogies...
4848

4949
<aside name="ram">
5050

51-
It's called "random access memory" because, unlike disc drives, you can
52-
theoretically access any piece of it as quick as any other. You don't have
51+
It's called "random access memory" because, unlike disc drives, you can
52+
theoretically access any piece of it as quick as any other. You don't have
5353
to worry about reading things consecutively like you do a disc.
5454

5555
Or, at least, you *didn't*. As we'll see, RAM isn't so random access anymore.
@@ -926,8 +926,7 @@ components?
926926
time you have performance-critical code that touches a lot of data, it's
927927
important to think about locality.
928928

929-
* Tony Albrecht's <a href="http://research.scee.net/files/presentations/gcapau
930-
stralia09/Pitfalls_of_Object_Oriented_Programming_GCAP_09.pdf"
929+
* Tony Albrecht's <a href="http://research.scee.net/files/presentations/gcapaustralia09/Pitfalls_of_Object_Oriented_Programming_GCAP_09.pdf"
931930
class="pdf">"Pitfalls of Object-Oriented Programming"</a> is probably the
932931
most widely-read introduction to designing your game's data structures for
933932
cache-friendliness. It made a lot more people (including me!) aware of how

html/data-locality.html

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,38 +35,38 @@ <h1 class="book"><a href="/">Game Programming Patterns</a><span class="section">
3535
<h2><a href="#intent" name="intent">Intent</a></h2>
3636
<p><em>Accelerate memory access by arranging data to take advantage of CPU caching.</em></p>
3737
<h2><a href="#motivation" name="motivation">Motivation</a></h2>
38-
<p>We&#8217;ve been lied to. They keep showing us charts where CPU speed goes up and up
39-
every year as if Moore&#8217;s Law isn&#8217;t just a historical observation but some kind
40-
of divine right. Without lifting a finger, we software folks watch our programs
38+
<p>We&#8217;ve been lied to. They keep showing us charts where CPU speed goes up and up
39+
every year as if Moore&#8217;s Law isn&#8217;t just a historical observation but some kind
40+
of divine right. Without lifting a finger, we software folks watch our programs
4141
magically accelerate just by virtue of new hardware.</p>
42-
<p>Chips <em>have</em> been getting faster (though even that&#8217;s plateauing now), but the
43-
hardware heads failed to mention something. Sure, we can <em>process</em> data faster
42+
<p>Chips <em>have</em> been getting faster (though even that&#8217;s plateauing now), but the
43+
hardware heads failed to mention something. Sure, we can <em>process</em> data faster
4444
than ever, but we can&#8217;t <em>get</em> that data faster.</p>
4545
<p><span name="legend"></span></p>
4646
<p><img src="images/data-locality-chart.png" alt="A chart showing processor and RAM speed from 1980 to 2010. Processor speed increases quickly, but RAM speed lags behind." /></p>
4747
<aside name="legend">
4848

49-
<p>Processor and RAM speed relative to their respective speeds in 1980. As you can
49+
<p>Processor and RAM speed relative to their respective speeds in 1980. As you can
5050
see, CPUs have grown in leaps and bounds, but RAM access is lagging far behind.</p>
5151
<p>Data for this is from <em>Computer Architecture: A Quantitative Approach</em>
52-
by John L. Hennessy, David A. Patterson, Andrea C. Arpaci-Dusseau by way of Tony
52+
by John L. Hennessy, David A. Patterson, Andrea C. Arpaci-Dusseau by way of Tony
5353
Albrecht&#8217;s &#8220;<a href="http://seven-degrees-of-freedom.blogspot.com/2009/12/pitfalls-of-object-oriented-programming.html">Pitfalls of Object-Oriented Programming</a>&rdquo;.</p>
5454
</aside>
5555

56-
<p>For your super-fast CPU to blow through a ream of calculations, it actually has
57-
to get the data out of main memory and into registers. As you can see, RAM hasn&#8217;t
56+
<p>For your super-fast CPU to blow through a ream of calculations, it actually has
57+
to get the data out of main memory and into registers. As you can see, RAM hasn&#8217;t
5858
been keeping up with increasing CPU speeds. Not even close.</p>
59-
<p>With today&#8217;s hardware, it can take <em>hundreds</em> of cycles to fetch a byte of data
60-
from <span name="ram">RAM</span>. If most instructions need data, and it takes
61-
hundreds of cycles to get it, how is it that our CPUs aren&#8217;t sitting idle 99%
59+
<p>With today&#8217;s hardware, it can take <em>hundreds</em> of cycles to fetch a byte of data
60+
from <span name="ram">RAM</span>. If most instructions need data, and it takes
61+
hundreds of cycles to get it, how is it that our CPUs aren&#8217;t sitting idle 99%
6262
of the time waiting for data?</p>
63-
<p>Actually, they <em>are</em> stuck waiting on memory an astonishingly large fraction of
64-
time these days, but it&#8217;s not as bad as it could be. To explain how, let&#8217;s take
63+
<p>Actually, they <em>are</em> stuck waiting on memory an astonishingly large fraction of
64+
time these days, but it&#8217;s not as bad as it could be. To explain how, let&#8217;s take
6565
a trip to the Land of Overly Long Analogies&#8230;</p>
6666
<aside name="ram">
6767

68-
<p>It&#8217;s called &#8220;random access memory&#8221; because, unlike disc drives, you can
69-
theoretically access any piece of it as quick as any other. You don&#8217;t have
68+
<p>It&#8217;s called &#8220;random access memory&#8221; because, unlike disc drives, you can
69+
theoretically access any piece of it as quick as any other. You don&#8217;t have
7070
to worry about reading things consecutively like you do a disc.</p>
7171
<p>Or, at least, you <em>didn&#8217;t</em>. As we&#8217;ll see, RAM isn&#8217;t so random access anymore.</p>
7272
</aside>
@@ -1083,8 +1083,7 @@ <h2><a href="#see-also" name="see-also">See Also</a></h2>
10831083
important to think about locality.</p>
10841084
</li>
10851085
<li>
1086-
<p>Tony Albrecht&#8217;s <a href="http://research.scee.net/files/presentations/gcapau
1087-
stralia09/Pitfalls_of_Object_Oriented_Programming_GCAP_09.pdf"
1086+
<p>Tony Albrecht&#8217;s <a href="http://research.scee.net/files/presentations/gcapaustralia09/Pitfalls_of_Object_Oriented_Programming_GCAP_09.pdf"
10881087
class="pdf">&#8220;Pitfalls of Object-Oriented Programming&#8221;</a> is probably the
10891088
most widely-read introduction to designing your game&#8217;s data structures for
10901089
cache-friendliness. It made a lot more people (including me!) aware of how

0 commit comments

Comments
 (0)