regexp: Optimize for inputs that are provably too short #31329
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
I'm following up on my work on
regexp
performance from #21463 with a couple smaller patches. This one is somewhat related.For many patterns we can compute the minimum length of the input at compile time. For instance, an HTTP router might use a pattern like
\/(path1|path2)\/(.+)\.html
, which has a minimum input length of 13 bytes.If the input is shorter than that, as may happen quite frequently, we can return early and get a huge speedup.
Some benchmarks are included in the CL.
Feedbacks welcome!
The text was updated successfully, but these errors were encountered: