alt.hn

3/17/2026 at 2:38:37 PM

Yes, all longest regex matches in linear time is possible

https://iev.ee/blog/all-longest-regex-matches-in-linear-time/

by g0xA52A2A

3/18/2026 at 11:12:35 AM

> input size normal hardened speedup w/ hardened

> 1,000 0.7ms 28us 25x

> 5,000 18ms 146us 123x

> 10,000 73ms 303us 241x

> 50,000 1.8s 1.6ms 1,125x

Why is there a normal mode if hardened mode is faster for all input sizes?

by nextaccountic

3/18/2026 at 12:53:55 PM

Sorry, finished the post just now with more comparisons on other inputs

The reason is just that the normal mode is faster in average non pathological cases

by ieviev

3/18/2026 at 1:38:15 PM

Could you have a heuristics based on the input size and the pattern to decide what to use?

by tracnar

3/18/2026 at 1:39:33 PM

Yes, this is entirely possible. you can even explore the automaton eagerly and detect if it's possible to loop from an accepting state to a nonaccepting one.

Exciting stuff for future work

by ieviev