For me locally on MRI it doesn't really change anything in terms of performance. I've extracted even more actions into methods.
The problem is that Lexer#advance is still huge. You can clone this branch locally and check what gets compiled. Here's a tiny script to show which actions are repeated most of all:
It prints top repeated actions, the number of times they get emitted, location in original lexer.rl and first 5 lines of the action. So, the first { ... ruby code ... } part that you'll see is the action itself.
I've extracted (as much as I can) all actions that are repeated 5 or more times. The size of Lexer#advance is still too big I suppose.
@headius @eregon May I ask you to take a look at this branch and check if it's enough? If it's not enough I just don't know what to do. And if so I'll probably revert https://github.com/whitequark/parser/pull/899 because this approach clearly doesn't work and only makes code less maintainable.
Continuation of https://github.com/whitequark/parser/pull/899.
cc @headius @eregon
For me locally on MRI it doesn't really change anything in terms of performance. I've extracted even more actions into methods.
The problem is that
Lexer#advance
is still huge. You can clone this branch locally and check what gets compiled. Here's a tiny script to show which actions are repeated most of all:It prints top repeated actions, the number of times they get emitted, location in original
lexer.rl
and first 5 lines of the action. So, the first{ ... ruby code ... }
part that you'll see is the action itself.I've extracted (as much as I can) all actions that are repeated 5 or more times. The size of
Lexer#advance
is still too big I suppose.@headius @eregon May I ask you to take a look at this branch and check if it's enough? If it's not enough I just don't know what to do. And if so I'll probably revert https://github.com/whitequark/parser/pull/899 because this approach clearly doesn't work and only makes code less maintainable.