“Pessimistic Programming”
summary
Benchmarks of a million iterations show exceptions for rare errors can be as fast as optionals in the common case but catastrophically slower in the worst case. Practical, tested techniques include using deque instead of vector when front inserts reduce jitter, nonblocking patterns like try_lock and timed waits and a cheap concurrent queue to bound latency, slicing work with time budgets or resumable coroutines, and writing constant-time comparisons to avoid timing leaks. Slides and source code live on the CppCon2018 GitHub.
AI-written summary · about
chapters (15)
- 0:00Introduction and background
- 3:58Why focus on worst case
- 8:14Exceptions vs optional performance
- 11:30Vector vs deque trade-offs
- 13:21Stable processing rates
- 20:53Polling vs event-driven models
- 25:03Compiler assumptions and control
- 30:13Non-blocking techniques
- 33:11Likely and unlikely branches
- 34:38Small functions and time management
- 37:06Progressive computation steps
- 41:26Critical vs accessory tasks
- 43:13Coroutines for resumable functions
- 45:21Timing attacks and security
- 52:05Q&A and conclusion
