3 ms·
At the risk of sounding like an idiot, what is the benefit of being able to match at compile time?
by arijun 3y ago
At the risk of sounding like an idiot, what is the benefit of being able to match at compile time?
- daemin 3y agoIt's not necessarily match at compile time, it's compile the regex at compile time to eliminate all superfluous runtime costs.
- lcvw 3y agoOne of the stated benefits is that the compiler optimizer can optimize the regex state machine that gets created, resulting in significantly faster match times at runtime. There are some benchmarks if you look up her cppcon talk about the library iirc. Edit: here is her talk, at 39 minutes she shares the benchmarks. https://m.youtube.com/watch?v=QM3W36COnE4 https://m.youtube.com/watch?v=QM3W36COnE4