mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
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 :^)
This commit is contained in:
parent
4be7239626
commit
97a333608e
Notes:
sideshowbarker
2024-07-17 18:29:29 +09:00
Author: https://github.com/alimpfard
Commit: 97a333608e
Pull-request: https://github.com/SerenityOS/serenity/pull/12653
Issue: https://github.com/SerenityOS/serenity/issues/12373
Issue: https://github.com/SerenityOS/serenity/issues/12615
Reviewed-by: https://github.com/trflynn89
5 changed files with 150 additions and 65 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue