~/talk

Effective replacement of dynamic polymorphism with std::variant

Talkat CppCon 2018 · 2018-09-23..09-28· [c-and-cpp]
slides:none on file

Compares three FSM implementations — single dynamic dispatch, double dispatch (visitor/CRTP) and several std::variant designs — by building a TCP-like state machine and microbenchmarking percentiles; variant implementations use std::visit, return std::optional next-state, avoid heap allocation and use value semantics, and show much lower latency and far tighter tail behavior (notably at the 99.9 percentile) than virtual-function approaches, so variant-based FSMs are faster, more deterministic, and practical where allocations and worst-case time matter.

AI-written summary · about

  1. 0:00Introduction and motivation
  2. 3:49Finite state machines overview
  3. 7:51Single dynamic dispatch
  4. 12:13Double dynamic dispatch
  5. 12:34Introduction to std::variant
  6. 16:57Variant-based FSM engine
  7. 21:19Performance comparison
  8. 23:31Comparison summary
  9. 26:39Q&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.