~/talk

Effective replacement of dynamic polymorphism with std::variant

Talkat ACCU 2019 · 2019-04-10..04-13· [c-and-cpp]
slides:none on file

Shows replacing virtual-based FSMs with std::variant plus visitors and occasional CRTP, removing heap allocations and virtual calls and using std::optional for “no-op” transitions. Implements three concrete FSMs (single dispatch, double dispatch/visitor, and variant-based visitors) and runs microbenchmarks that show variant solutions are substantially faster and also produce measurable improvement in production latency. Code uses value semantics, fold-expression tests for transition sequences, and avoids dynamic polymorphism and runtime allocation.

AI-written summary · about

  1. 0:00Introduction to low latency
  2. 2:26Alternatives to polymorphism
  3. 4:08Traditional dynamic dispatch
  4. 7:18Double dynamic dispatch
  5. 9:12Curiously recurring templates
  6. 11:21Performance of dispatch types
  7. 13:25Variant approach in design
  8. 16:09CRTP and variant combined
  9. 18:48Benchmarking and conclusion
~/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.