-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request to optimize recognizers matching #141
Comments
I did a couple rounds of recognition call optimization in the past. I guess that 60% of time spent in recognizers is pretty fine if you don't have complex actions attached you can expect that most of time is spent in choping the input string. I would be happy to review a PR if you find a way to improve performance. You can start by looking here. There is one optimization implemented based on precalculating the cut-off place, e.g. if recognizer succeeds and it is marked with finish flag further recognizers are not tried. See here. If you are doing this in a commercial setup and need consulting you can contact me directly at igor dot dejanovic at gmail. |
Don't realy remmeber the implementation details but
As result you will get the index of first recogniser matched: |
Could not make it work:
|
I don't think that can work because different groups of recognizers are tried in different order at different parser states. This approach is sometimes called "context-aware" lexing. That means in order to optimize by concatenating regexes you would have to make all possible variations for all possible parser states and track which one to use in each state. Not to mention that it is possible to have multiple recognizers match if there is lexical ambiguity, which is perfectly allowed in GLR parsing. |
Description
Could you speedup recognisers matching?
I have 10MB source files and >100 number of recognisers.
Profiling telling 60% time spent on it.
I was thinking of doing it myself. Not sure I can.
Is it important the order of recognisers matching?
Do you have idea how the algorithm should be modified?
The text was updated successfully, but these errors were encountered: