~/talk

Write Fast Code Like a Native

Talkat CppNorth 2024 Β· 2024-07-21..07-24Β· [software-architecture]
links:none on file
slides:none on file

Walks through microbenchmarks using std::chrono, rdtsc/rdtscp and RDPMC, plus Godbolt and cycle counters, to build a latency intuition. Shows a naive matrix transpose costing ~250 ns (720 cycles) for tiny sizes and scaling to thousands of times slower when memory spills caches; a summation that the optimizer turns into a closed form (with O2 off it matches expected ~2,000,000 ns); XGBoost prediction costs ~60 assembly instructions per shallow tree (~0.1 ns per tree evaluation), and IO stays in millisecond land (disk spin ~8 ms, 10 Gb/s β‰ˆ 1 s/GB). Advises measure with RDPMC, avoid syscalls on the fast path, use templates for zero-overhead abstractions.

AI-written summary Β· about

  1. 0:00Introduction and background
  2. 3:48Why write fast code
  3. 7:01Understanding CPU latencies
  4. 11:20Profiling tools and techniques
  5. 15:11Case study: Matrix transpose
  6. 22:42Case study: Summing numbers
  7. 27:42I/O and real-world operations
  8. 28:02Case study: XGBoost performance
  9. 33:19Code constructs and performance
  10. 39:58Philosophy of optimization
  11. 48:52Q&A session
~/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.