HackerTube

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

NOKIA Technology Center Wrocław3 HN recommenders · recommended in 3 months, 2018–2023
YouTube
talk · intermediate · evergreen · 2018–2023 on HN

Scott Meyers explains how CPU caches work and why they matter for performance, covering cache levels, access speeds, associativity, and effects in multithreaded code. The focus is C++ and cache-aware, data-oriented programming.

HN points to it as the go-to explanation of why memory layout beats pointer-chasing structures on real hardware.

6 comments from Hacker News

@drainyard2018-10 · in “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: ▶ this video CppCon 2014: Mike Acton "Data-Oriented Design and C++": link They're mostly about C++ and cache aware/data oriented programming.

Strongly recommends View on HN
@coppsilgold2023-04 · in “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: < ▶ this video >

Recommends View on HN
@jimmy12018-04 · in “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. ▶ this video

Recommends View on HN
@insanitybit2022-11 · in “In defense of linked lists”

I don't buy this. ▶ 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 one of the L2 prefetchers help, I would expect that you'll see better L2 performance due to prefetching. If you have an example of a linked list being as fast as a vector for iteration, please do show it.

Critical View on HN
@game_the0ry2021-12 · in “A single line of code made a 24-core server slower than a laptop”

Relevant video - Scott Meyers: Cpu Caches and Why You Care ▶ 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.