Why does std::format do that?
summary
Explains why std::format is both fast and compact: implemented in msvc implementation based on {fmt}, it uses type erasure to pack arguments (avoiding combinatorial code bloat) and replaces an array-of-variants layout that costs three pointers per arg with a compact two-array store, adds an erased output iterator (fmt_buffer) that cuts ~30KB per iterator type, requires /utf-8 for big speedups, and ships in Visual Studio 2019/2022 with defect‑report fixes pending for C++20.
AI-written summary · about
chapters (18)
- 0:00Intro
- 2:13Format
- 3:58Specifiers
- 5:49Performance
- 8:59Implementation
- 10:39Type erasure
- 11:35Same code
- 14:13Different methods
- 15:02Format functions
- 18:20Format arguments
- 24:14Format arg
- 25:36Output iterator type
- 33:42Optimizations
- 42:47Format Type
- 44:26Open Source Contributions
- 50:15Use utf8
- 52:12Why not throw an exception
- 55:40Signature of format
related talks
04mConstexpr and operator overloading: Why everything is terrible
24mDemystifying V8 and JavaScript Performance
27mThe Life of a JavaScript Feature in V8 ft. TypedArrays
56mEmbind and Emscripten: Blending C++11, JavaScript, and the Web Browser
23mFast by default: algorithmic performance optimization in practice
23mV8 Internals for JS Developers
30mV8 internals for JS developers
59mEmscripten and asm.js: C++'s role in the modern web
