Applied modern C++: efficient expression evaluator with type erasure
summary
A working C++ expression evaluator uses type erasure with SSO and a parser-owned memory arena to store small literals in-place, plus constant simplification to fold constant subtrees, and supports numbers, strings, lists, dates and common functions. Benchmarks show a naive OO AST about 7× slower than raw C++ expression evaluation; the type-erased SSO version narrows that gap (benchmarks report roughly 3–1.2× slower depending on expression complexity) and processes millions of rows practically fast.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 2:28Clinical data evaluator motivation
- 8:01Expression evaluation and AST
- 10:30Naive OOP node implementation
- 14:30OOP performance limits
- 14:52Type erasure overview
- 18:51Type erasure with SSO
- 23:10SSO strategy improvements
- 33:37SSO for literal and variable nodes
- 35:06SSO for binary operators
- 37:12Benchmark results
- 38:16Supported operations
- 39:44Constant simplification
- 40:27Project learnings
- 41:21Q&A
related talks
01h 03mType Erasure - The Implementation Details
01h 00mSix Ways for Implementing Math Expressions Calculator in C++
01h 01mPractical Type Erasure
44mPragmatic Type Erasure: Solving OOP Problems w/ Elegant Design Pattern
01h 04mFunctional C++ for Fun and Profit
56mPractical C++17
55mHow bad is meta-programming still today?
01h 36mPlenary: Cooperative C++ Evolution - Toward a Typescript for C++
