Template Meta-State Machines, Madness and Shannon
summary
A C++ library implements an extreme template meta-state machine using computed goto, an unordered_tuple of transition wrappers and a generated perfect hash generator; it translates FIX to a binary exchange format in a simulator, parallel-brute forces xor-modulo hash seeds, and compares against an if-else chain on Ryzen 9 3900. The claim is a measurable latency win in some cases (targeting under about 20 clock cycles for mispredicted branches) over millions of samples (~10 million orders) but at huge compile-time, complexity and occasional hash-generation failures due to limited entropy.
AI-written summary · about
chapters (14)
- 0:00Template meta-programming madness
- 1:11Computed goto state machines
- 5:26Branch prediction limits
- 9:03Premature optimization
- 12:54State transition table design
- 20:34Type safety vs virtual functions
- 27:41Optimizing computed goto
- 33:28Hashing requirements
- 37:19XOR modulo hash
- 41:56MIT bit translator fix
- 46:15Test setup
- 50:12Results analysis
- 53:46GCC vs Clang performance
- 1:03:05Micro optimizations
related talks
01h 26mLow-Latency Trading Systems in C++: Templated Meta-State Machines in HFT
05mLightning Talk: Powered by C++20 Meta-Programming (MP)
01h 00m“State Machines Battlefield - Naive vs STL vs Boost”
01h 13mModernizing Finite State Machines in C++ - Empower Simplicity & Boost Performance With std::variant
05m[BOOST].SML STATE MACHINE LANGUAGE
41mC++11 Metaprogramming Applied to Software Obfuscation
01h 06m“C++ Metaprogramming: Journey from simple to insanity and back"
01h 00mModern Template Metaprogramming: A Compendium, Part I
