~/talk

Breaking Dependencies - The Visitor Design Pattern in Cpp

Talkat CppCon 2022 · 2022-09-11..09-16· [frontend-architecture]
slides:none on file

Argues the Visitor pattern tradeoff with concrete code and microbenchmarks: classic visitor uses two virtual calls per operation and suffers large slowdowns; a modern std::variant-based visitor uses value semantics, avoids heaps and virtuals, and runs faster in the presented benchmark; an alternate mpark::variant implementation is fastest. Benchmarks run on 10,000 mixed shapes with 2,500 translate operations, tested on GCC and Clang. Also demonstrates an acyclic (dynamic_cast) visitor that is functionally possible but “terribly slow,” so the variant approach works and is recommended.

AI-written summary · about

  1. 0:00The problem with enums
  2. 12:43Object-oriented solution
  3. 17:29The classic visitor pattern
  4. 21:18Visitor pattern in code
  5. 26:27Modern visitor with variant
  6. 31:17Modern visitor benefits
  7. 35:48Performance comparisons
  8. 39:25Classic vs modern visitor
  9. 44:25Advanced visitor techniques
  10. 49:28Visitor pattern summary
  11. 55:38Q&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.