C++ as an Optimizing Assembler - a Performance Talk
summary
Builds a tiny C++ runtime compiled with -nostdlib and -march=haswell that invokes Linux syscalls directly (write exit open close mmap) and fixes TLS by allocating a 4K page and setting FS, reads generated assembly with Intel syntax in GDB, measures hotspots with perf record and microbenchmarks with nanobench, optimizes an i2a routine by doing two digits at once and removing cache-misleading lookup tables, verifies std::vector push_back has a real-lock cost (~33 ms in the test), and shows a Bolin compiler prototype reaching about 3.1M lines/s.
AI-written summary · about
chapters (9)
- 0:00Introduction and goals
- 1:50Writing a custom runtime
- 8:26Implementing system calls
- 15:34Thread-local storage fix
- 17:01Optimization basics with perf
- 22:38Optimizing integer to ASCII
- 29:43Cache and memory insights
- 30:45STD vector lock experiment
- 33:13Compiler performance results
related talks
58mOptimization Tips - Mo' Hustle Mo' Problems
01h 37mAn Overview of Program Optimization Techniques
01h 11m“Benchmarking C++ Code"
05mLightning Talk: Micro C++ Benchmarks & Murphy's Law
58mC++ Performance and Optimisation
01h 05mFast and small C++ - When efficiency matters
59mCounting Nanoseconds Microbenchmarking C++ Code
01h 00mMoving Faster: Everyday efficiency in modern C++
