~/talk

Cache Friendly C++

Talkat Meeting C++ 2025 · 2025-11-06..11-08· [web-performance]
links:none on file
slides:none on file

Claim: use std::vector by default because contiguous storage beats pointer chasing. Concrete evidence: benchmarks on Apple M1 show RAM ~70 GB/s, L1 ~64–128 KB (≈3 cycles), L2 ≈8–12 MB (≈18 cycles), main memory adds ~100 ns and you hit cliffs near 2–4 MB. Surprises: sorted vector often outperforms unordered_map; random versus sequential access differs dramatically; false sharing kills multithreaded scaling. Tools and remedies: measure with perf, prefer open addressing hash tables, consider flat_map or hive, reorder fields and pad to cache line (64/128 B).

AI-written summary · about

  1. 0:00Introduction
  2. 2:49Cache friendly C++ matters
  3. 4:53CPU caches and cache misses
  4. 11:18Smaller data types
  5. 16:35Bit fields and struct reordering
  6. 21:51Cache lines and prefetching
  7. 26:04Cache friendly containers
  8. 29:51Instruction caches and code layout
  9. 33:19Data vs object oriented design
  10. 39:36Caches and multi-threaded performance
  11. 46:45Summary
  12. 48:52Q&A
  13. 50:37Cache line sizes
  14. 52:00SOA vs AOS design
  15. 53:47Tools for cache analysis
  16. 54:28Pointer flag optimization
  17. 56:54Data oriented design applications
  18. 57:58Pointer authentication and cache tricks
  19. 58:39Cache friendly code across CPUs
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.