0Pricing
C++ Academy · Lesson

Cache-Friendly Data Layouts

Design structures of arrays and pack data for cache locality.

The Memory Hierarchy

CPUs have multiple cache levels (L1, L2, L3) much faster than main memory. Cache-friendly code keeps hot data close to the CPU.

Cache Lines

Memory is fetched in cache lines — typically 64 bytes. Reading one byte loads the whole line. Use this to your advantage.

All lessons in this course

  1. Cache-Friendly Data Layouts
  2. Branch Prediction and Hot Loops
  3. Profiling with perf vtune and Sanitizers
  4. Micro-benchmarking with Google Benchmark
← Back to C++ Academy