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

Channel:NOKIA Technology Center Wrocław · Length:1:16:57 · Published:2015-01-05 · Views:231844

Watch on YouTube

Summary

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.

Why HN recommends it

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

Scott Meyers had a very good talk which contained this information — HN, 2023

C, C++, Rust, Go & systems languages · Software performance & optimization · Computer architecture & CPUs

Subtitles (excerpt)

ladies and Gentlemen let's bring our hands together for Scott Meers thank you very much I can see it's going to be an excellent talk since the first thing what that happened was that the person Introducing Me emphasized old I am thank you very much for that that's what happens when you hire a professional he also emphasized my extensive background in C++ thank you for that this talk is not about C++ this talk is about something which is more fundamental than C++ this talk is about the hardware I want to talk about CPU caches because this is what is ultimately going to determine the performance of your program it does not matter what programming language you are using does not matter what application you are trying to develop it doesn't matter any of that stuff at the end of the day the hardware determines what is going to happen we need to understand how the hardware works I want to start with every simple problem let us suppose we have a matrix and what we want to do is visit every element of the Matrix maybe to find out how many nonzero elements we have perhaps to add up the total number of values in the elements there's two basic ways that we can Traverse this Matrix we can go row by row this is known as a row major traversal it visits every

On Hacker News

Two of my favorites: code::dive conference 2014 - Scott Meyers: Cpu Caches and Why You Care: [VIDEO] CppCon 2014: Mike Acton "Data-Oriented Design and C++": [LINK] They're mostly about C++ and cache aware/data oriented programming. — drainyard, 2018-10
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: < [VIDEO] > — coppsilgold, 2023-04
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. [VIDEO] — jimmy1, 2018-04
Relevant video - Scott Meyers: Cpu Caches and Why You Care [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. — game_the0ry, 2021-12
> If your primary operation is inserting at a random location in the list, linked lists are faster than arrays at large sizes. You avoid having to move all the memory after the index you are modifying (to make space for the inserted element). This is false. Big O notation says it should be true, you'll get marked wrong if you say arrays are faster in your algorithms & data structures final, but w… — reificator, 2020-12

Related videos