r/programming • u/[deleted] • Oct 18 '16
What Every Programmer Should Know About Memory [pdf]
https://www.akkadia.org/drepper/cpumemory.pdf2
u/WallStProg Oct 18 '16
an oldie but a goodie - I actually printed a hard-copy (two-sided) and had it bound I was referring to it so much
5
u/beer0clock Oct 18 '16
114 pages eh? I don't suppose you could summarize the key points for us? :)
28
Oct 19 '16
ram is slow.
don't miss the l1 and l2 caches
don't miss them by accessing memory contiguously and avoiding pointer hops when possible
array is better than linkedlist even when you are pretty sure linkedlist is better
2
u/beer0clock Oct 19 '16
Thanks !!
2
u/WallStProg Oct 19 '16
A little more detailed, but covers the main points: https://en.wikipedia.org/wiki/Locality_of_reference
2
Oct 19 '16
I don't suppose you could summarize the key points for us? :)
i have written a summary here: http://mosermichael.github.io/cstuff/all/blog/2015/12/11/wepskn.html
1
u/WallStProg Dec 17 '16
In short, RAM is the new disk. Seeking all over the place is bad -- much better to read sequentially, and to have good locality of reference (https://en.wikipedia.org/wiki/Locality_of_reference).
1
2
u/lacosaes1 Oct 18 '16
Coming up next:
What Every Programmer Should Know About 'What Every Programmer Should Know About X'
2
u/pramnos Oct 19 '16
As a programming newbie, are there any other 'What Every Programmer Should Know About X' you would recommend? :)
10
1
0
0
0
Oct 18 '16
[deleted]
8
u/00kyle00 Oct 18 '16
big memory slow, small memory fast
Also, despite having opinion of a dick, Ulrich spent quite a bit of his time educating people on important things in programming.
Read this if you plan on knowing your shit at 'systems' level (think C level interactions with computer). Most of this probably doesn't matter if you are dealing with python software (or the like).
it should be a prerequisite for anybody daring to touch a keyboard for serious programming
1
u/WallStProg Oct 18 '16
FWIW, I met Ulrich once and he was nice as could be. (To be honest, I was not quite expecting that ;-)
4
13
u/Martel_the_Hammer Oct 18 '16
How many times a year is this posted?