01Chapter 1: Why memory is slower than the CPU: the memory hierarchyThis chapter assumes you can read C and are comfortable with arrays, structs, and pointers. You should know Big-O notation. You do not need any hardware background. The numbers below are typical for a desktop or server x86-64 or ARM processor from the last several years. Your machine will differ, an5 min read
02Chapter 2: Cache lines: how data actually movesThis chapter assumes you know that a CPU cache sits between the core and main memory, and that it is much faster than memory. It also assumes you can read C and do basic binary and hexadecimal arithmetic. Here you will learn what unit of data moves between memory and the cache, how an address maps o5 min read
03Chapter 3: Spatial and temporal localityThis chapter assumes you can read C, know what arrays, structs, and pointers are, and have seen the idea of a cache line from the previous chapter. Locality is the property of a program that lets caches work. A cache can only help if the program reuses data it touched recently, or touches data near 6 min read
04Chapter 4: Traversal order: row-major access and stridesYou should know C or a similar language, how multidimensional arrays are declared, and what a pointer is. You should also know the previous chapters' model: data moves between memory levels in cache lines, commonly 64 bytes. This chapter applies that model to the simplest case, a loop over a 2D arra4 min read
05Chapter 5: Arrays versus linked structuresThis chapter assumes you know what a cache line is and why sequential access is faster than scattered access. It also assumes you are comfortable with C pointers, structs, and Big-O notation. The goal is to decide when a contiguous array beats a pointer-based structure such as a linked list, and to 5 min read
06Chapter 6: Compulsory, capacity, and conflict missesThis chapter assumes you know what a cache line is, the difference between spatial and temporal locality, and basic C. It also assumes you can read a loop nest and estimate how much memory it touches. Earlier chapters covered those ideas. Here they become a tool for diagnosing why a particular acces7 min read
07Chapter 7: Alignment, padding, and field orderThis chapter assumes you can read C structs and know that a cache line is the unit the CPU moves between memory and cache, typically 64 bytes. You do not need assembly knowledge. The goal is to predict sizeof for a struct, shrink it by reordering fields, and understand why a smaller struct runs fa5 min read
08Chapter 8: Array of structs versus struct of arraysThis chapter assumes you know C structs and pointers, and that you have read the earlier chapters on cache lines, traversal order, and padding. You should be comfortable with the idea that a cache line (commonly 64 bytes) is the unit the CPU loads from memory.5 min read
09Chapter 9: Splitting hot and cold dataThis chapter assumes you know the cache-line model from earlier chapters: memory moves in 64-byte lines, and a loop is fast when most bytes in each loaded line get used. It also assumes you are comfortable with C structs and the array-of-structs versus struct-of-arrays distinction.4 min read
10Chapter 10: Hardware prefetching and predictable access patternsThis chapter assumes you know what a cache line is and how misses cost time, and that you can read C. Earlier chapters showed that sequential traversal is fast. Here you will see one mechanism behind that: the CPU guesses which lines you will need next and fetches them early. Knowing how it guesses 5 min read
11Chapter 11: Measuring cache behavior without fooling yourselfThis chapter assumes you can read C and C++, know the cache line and locality ideas from earlier chapters, and can use a Linux command line. You will learn how to time code reliably, how to read hardware counters, and which mistakes make a benchmark report something other than what you meant to test6 min read
12Chapter 12: Associativity and conflict misses from power-of-two stridesThis chapter assumes you know how a cache line works, the difference between capacity and conflict misses, and how row-major arrays are laid out. It explains why a loop can run slowly even when its data fits in the cache, and why padding an array can fix it.5 min read
13Chapter 13: Blocking (tiling) for matrix-style loopsThis chapter assumes you have read the earlier chapters on cache lines, locality, and traversal order. You should be comfortable with C arrays, nested loops, and the idea that a cache line (commonly 64 bytes) is the unit of transfer between memory and cache.6 min read
14Chapter 14: Cache-friendly hash tables: open addressing versus chainingThis chapter assumes you can read C, know how a hash table works at the level of "hash the key, pick a bucket, resolve collisions", and have read the earlier chapters on cache lines, spatial locality, and arrays versus linked structures. Here you will compare the two main collision strategies by cou4 min read
15Chapter 15: Wide-node trees: why B-trees beat binary trees in memoryThis chapter assumes you know the cache line model from earlier chapters: memory moves in 64-byte blocks, and a pointer chase can cost a full miss. You should also be comfortable with binary search trees, big-O notation, and C structs.5 min read
16Chapter 16: False sharing between threadsThis chapter explains how two threads can slow each other down without sharing any data. You should already know what a cache line is, how a struct is laid out in memory, and how to start threads and join them in C++. You don't need to know cache coherence protocols in detail. The chapter explains t5 min read
17Chapter 17: TLB misses and page-level localityThis chapter assumes you know what a cache line is and how spatial locality works, and that you can read C. It also assumes you have seen virtual memory described at least once. The chapter covers a cost that sits next to cache misses: the cost of translating addresses.5 min read
18Chapter 18: Cache-oblivious algorithms and layoutsThis chapter assumes you have read the earlier chapters on cache lines, traversal order, and blocking (tiling). You should be comfortable with recursion and with reading C.5 min read