Skip to content
0:00 / 0:00

#cpucache#c++#cachelocality

code::dive conference 2014 - Scott Meyers: Cpu Caches and Why You Care

NOKIA Technology Center Wrocław

2.6K subscribers • 1 video on Hallway

YouTube
  • Recommended by 4 people: 3 on Hacker News and 1 on Lobsters.
  • A classic. People kept recommending it from 2018 to 2023.
  • Presented by Scott Meyers

Advanced. Deep dive for people who know the field.

230K views11 years ago4 recommendations

Systems programmingComputer sciencePerformance and optimizationConcurrency and parallelismMemory management

Scott Meyers explains how CPU caches work, covering cache levels, associativity, and how data layout and access patterns impact software performance.

code::dive conference 2014 - Nokia Wrocław codedive.pl/

Why it's here

4 people recommend this, 1 disputes it

What people say. Widely recommended as an essential talk on CPU cache mechanics, memory locality, and writing cache-friendly code.

drainyardon Hacker News • Recommends

On “Ask HN: What are some of the best technical talks you've heard?”

Two of my favorites: code::dive conference 2014 - Scott Meyers: Cpu Caches and Why You Care: link to this video CppCon 2014: Mike Acton "Data-Oriented Design and C++": link They're mostly about C++ and cache aware/data oriented programming.

jimmy1on Hacker News • Recommends

On “Intel brings a six-core i9 CPU to laptops”

Here is a good visualization on access speeds for each level of cache, then main memory. Now take the main memory access time and essentially double it (for your state of the art SSD's today) and that's the access speed. link to this video

coppsilgoldon Hacker News • Recommends

On “Beautiful branchless binary search”

Cache associativity, conflict miss. You have too many memory addresses mapping to the same cache lines all being used together at the same time. Scott Meyers had a very good talk which contained this information: < link to this video >

dbremneron Lobsters • Recommends

Cpu Caches and Why You Care (2014)

insanitybiton Hacker News • Disputes

On “In defense of linked lists”

I don't buy this. link to this video Prefetching in CPUs predates this talk. link That talk is 2018. Cache prefetching works best for linear accesses like with a vector, not for random pointer lookups. Prefetchers are also going to have an extra harder time with double indirection since they're unable to see which value is going to be fed to the lea. Prefetching is also expensive in and of itself, the CPU doesn't do it unless you're already incurring cache hits. This makes cache misses even worse . There are also multiple prefetchers in the CPU and the L1 prefetcher is very basic and is only going to help with contiguous accesses. Your allocator might be doing some nice things for you that let the on…

u/New_Computer3619in r/C_Programming • Mentions

On “Anyone have a good textbook / reference on memory caching?”

You can read "What every programmer should know about memory" (Link below). The first part of this text describe computer memory at hardware/physical level. If you only interested in software, you can skip that part. You can also check out Scott Meyer's talk on CPU caches topic. Maybe you should listen to the talk before reading the text above. https://www.google.com/url?sa=t&source=web&rct=j&url=https://people.freebsd.org/~lstewart/articles/cpumemory.pdf&ved=2ahUKEwiDmKKvg9LxAhXYWisKHQuQBGEQFjAAegQIAxAC&usg=AOvVaw3VY2lnCBaI-B57Dric65cb link to this video

u/ISvengaliin r/softwarearchitecture • Mentions

On “In a b-tree, is it faster if all nodes are near by memory location?”

This is a huge topic. The slightly sad truth is being cache aware can speed things up by 2 orders of magnitude. The basic tower of speed looks like so: Registers > cache >> main memory >> SSD >> HDD >> DSL >> Pigeon Registers are a bit faster than cache, while it is considerably faster than main memory. SSDs are quite a bit slower, but catching up to main memory (I dont necessarily think theyll ever get there, but who knows!). Theres quite a few good videos on writing cache aware code, such as this one from Scott Meyers. They mostly come down to - use arrays. Partial storage is definitely possible and sometimes done when you have HUGE workloads, but, its pretty cheap to gra…

u/exodusTayin r/C_Programming • Mentions

On “Can you give me some proof that storing multidimansional data into a 1d array is the standard and best way to do it?”

Having multiple indirections(pointer to pointers) is not cache friendly. watch this: link to this video

reificatoron Hacker News • Mentions

On “An iOS zero-click radio proximity exploit odyssey”

…y Bjarne Stroustrop (Creator of C++) that even includes imaginary graphs demonstrating this phenomenon. If you want a visual for what the missing graph was supposed to look like, here's a similar one.1 Here's another video2 by Scott Meyers (Author of Effective C++) that goes into more detail about why this happens. 0: link 1: link 2: link to this video…

game_the0ryon Hacker News • Mentions

On “A single line of code made a 24-core server slower than a laptop”

Relevant video - Scott Meyers: Cpu Caches and Why You Care link to this video Remember, boys and girls, small mistakes can have big consequences. Keep those data in immutable data structures when mutli-threading. Actor model also helps.