-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
Maybe less impactful with #341, but it should be possible to look at the regex syntax Hir, and simplify simple regexes like http.path ~ "^/abc/123/?$" into http.path == "/abc/123" || http.path == "/abc/123/". Local testing seems to suggest that with any more than 2 alternations, it's faster to leave a regex.
This would require:
- The AST already parses into a regex. Maybe it shouldn't, maybe we should have our own "HIR" or something, otherwise we'd pay the cost of compiling the regex, then throw that work away to convert it back to string equality.
- Similarly, we need to handle captures specially: The caller could observe the difference between a regex and string equality comparisons, because
Match.captures[0]will be populated for the regex but not for the string equality. An intermediate representation could preserve that behavior by knowing the original match was by regex.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels