~/talk

A deep dive into dispatching techniques

Talkat Meeting C++ 2022 · 2022-11-17..11-19· [frontend-architecture]
links:none on file
slides:none on file

A small stack bytecode interpreter is built and benchmarked (recursive Fibonacci) using hyperfine and perf with assembly inspection; a switch dispatch measures about 460 ms on a 2020 Apple Mac Mini M1 while token/label threading and tail-call chaining cut runtime roughly in half on that CPU by improving branch prediction and keeping state in registers. perf shows branches and branch misses dominate; on a cheap ThinkPad 2016 the switch wins because branch‑target prediction is poor. Measure on target, inspect assembly, and pick the technique that actually helps.

AI-written summary · about

  1. 0:00Introduction
  2. 1:03Dispatch loop and bytecode interpreters
  3. 8:26Basic dispatch with switch
  4. 13:45Branch prediction in dispatch loops
  5. 15:52Call threading to avoid branches
  6. 19:01Token threading and computed goto
  7. 23:57Tail calls and register optimization
  8. 29:13Register keyword limitations
  9. 31:44Slow paths and register spilling
  10. 36:17Benchmarking on hardware
  11. 39:45Advanced dispatching techniques
  12. 42:30Inline dispatch and JIT compilation
  13. 42:51Key takeaways and final advice
  14. 51:20Q&A
~/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.