1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:27:46 +00:00

LibRegex: Add the literal string search optimisation

This switches to using a simple string equality check if the regex
pattern is strictly a string literal.
Technically this optimisation can also be made on bounded literal
patterns like /[abc]def/ or /abc|def/ as well, but those are
significantly more complex to implement due to our bytecode-only
approach.
This commit is contained in:
Ali Mohammad Pur 2023-07-28 20:59:33 +03:30 committed by Andreas Kling
parent 221c52c696
commit 18f4b6c670
6 changed files with 82 additions and 4 deletions

View file

@ -231,6 +231,7 @@ public:
private:
void run_optimization_passes();
void attempt_rewrite_loops_as_atomic_groups(BasicBlockList const&);
bool attempt_rewrite_entire_match_as_substring_search(BasicBlockList const&);
};
// free standing functions for match, search and has_match