Niall Douglas wrote:
Hana's runtime benchmarks showed her regex implementation far outpacing any of those in the standard libraries. Like, an order of magnitude in absolute terms, linear scaling to load instead of exponential for common regex patterns. A whole new world of performance.
Part of why her approach is so fast is because she didn't implement all of regex. But another part is because she encodes the parse into relationships between literal types which the compiler can far more aggressively optimise than complex types. So basically the codegen is way better, because the compiler can eliminate a lot more code.
I've looked at CTRE, I know what it does, how it does it, and how well it performs. It is, as I said, a remarkable piece of engineering, and I respect Hana for her work. https://pdimov.github.io/blog/2020/05/15/its-a-small-world/ Nevertheless, I have a not-entirely-uninformed hunch that a runtime engine can perform on par. Of course, until/unless I can substantiate this more thoroughly, by for example writing a runtime regex engine that exhibits similar performance to CTRE, you can file this under "idle speculation".