diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2022-02-20 03:25:21 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-20 11:53:59 +0100 |
commit | 97a333608e576448834a936b95dadda0e43c57a8 (patch) | |
tree | 41adfaea9cd5b4e95f3205258e7850daca7491cd /Userland/Libraries/LibRegex/RegexDebug.h | |
parent | 4be7239626c02709a34a825be44a5a73a2c1ea77 (diff) | |
download | serenity-97a333608e576448834a936b95dadda0e43c57a8.zip |
LibRegex: Make codegen+optimisation for alternatives much faster
Just a little thinking outside the box, and we can now parse and
optimise a million copies of "a|" chained together in just a second :^)
Diffstat (limited to 'Userland/Libraries/LibRegex/RegexDebug.h')
-rw-r--r-- | Userland/Libraries/LibRegex/RegexDebug.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Userland/Libraries/LibRegex/RegexDebug.h b/Userland/Libraries/LibRegex/RegexDebug.h index 8d22fbd419..6b9d343fbc 100644 --- a/Userland/Libraries/LibRegex/RegexDebug.h +++ b/Userland/Libraries/LibRegex/RegexDebug.h @@ -35,9 +35,12 @@ public: template<typename T> void print_bytecode(Regex<T> const& regex) const { - MatchState state; - auto& bytecode = regex.parser_result.bytecode; + print_bytecode(regex.parser_result.bytecode); + } + void print_bytecode(ByteCode const& bytecode) const + { + MatchState state; for (;;) { auto& opcode = bytecode.get_opcode(state); print_opcode("PrintBytecode", opcode, state); |