[normalized Sound] A deep dive into dispatching techniques
summary
Benchmarks many dispatch styles (switch/binary-search, jump tables, function-pointer threading, computed-goto token threading, tail-call chaining and inline fusion), shows generated assembly and uses hyperfine and perf on an M1 Mac Mini and a 2016 ThinkPad to compare. Claim: tail-call/token/threading plus careful register use often halves runtime on M1, but jump tables and direct-target bytecode blow up Branch‑Target misses on the older ThinkPad, so compiler choices and a clang-only tail-call attribute matter. Lots of microbench numbers, tool commands, and assembly snippets; implementations and tradeoffs are shown and measured.
AI-written summary · about
chapters (9)
- 0:00Start
- 0:47Dispatch Loop
- 6:32Execute instructions
- 8:39Idea: switch over opcode
- 13:40Interlude: Instruction pipeline
- 22:18Duplicated dispatch code
- 29:03Interlude: register keyword
- 31:40An instruction with a slow path
- 39:06Actual actual generated assembly for a switch
related talks
45mBack to Front and Beyond
42mLet the Main Thread Breathe!
27mAnd Benchmarks for All!
47mLinkage in the Third Millenium. Ideas, Innovations, Experiments and Prototypes for Fl...
30mVisualizing process evolution
22mUsing WebAssembly and Threads
40mThreads in Embedded Linux- 6 Easy Pieces
33mScaling Swift Development
