~/talk

“State Machines Battlefield - Naive vs STL vs Boost”

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

Benchmarks compare naive if/else and switch (about 64 lines of code, very well inlined) versus object‑oriented vtable approach (about 220 lines of generated assembly, heap allocations) and STL approaches: std::variant inlines well on Clang but not GCC, coroutines use heap and show poorer optimization. Boost.Statechart generates ~3k assembly and is slow, MSM is expressive but has very long compile times; Boost.SML gives a readable transition table, configurable compile‑time dispatch and the best compile/runtime/size balance.

AI-written summary · about

  1. 0:00The problem with state
  2. 3:14Introduction to state machines
  3. 5:31Naive implementation: If-else
  4. 10:09Naive implementation: Switches
  5. 12:28State pattern
  6. 16:18Modern C++: std::variant
  7. 23:52C++20 Co-routines
  8. 36:55Boost libraries: MSM and Chart
  9. 44:01SML library
  10. 52:52Benchmarks 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.