-
-
Notifications
You must be signed in to change notification settings - Fork 81
java: Use a generated keyword matcher to improve performance #445
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
java: Use a generated keyword matcher to improve performance #445
Conversation
Aside from being good practice, extensibility if not designed for should be prohibited, this will help isolate some of the effects of #445.
Aside from being good practice, extensibility if not designed for should be prohibited, this will help isolate some of the effects of #445.
71452c8 to
3551231
Compare
jkronegg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job! The generated code looks good and the give confidence on the loop unrolling.
On my realworld project with 740 BDD scenarios, the GherkinMessagesFeatureParser.parse is 25% faster than with the main branch (100 ms -> 75 ms).
java/src/main/java/io/cucumber/gherkin/GherkinTokenMatcher.java
Outdated
Show resolved
Hide resolved
That is incredible. If you have more ideas I'd be happy to see them. 👍 |
🤔 What's changed?
Improve performance by matching step and title keywords using a generated matcher class.
Before
main@ b3413a9After
⚡️ What's your motivation?
In #443 @jkronegg shows that unrolling the loops over the keywords speeds gherkin parsing significantly. I'm not sure about the theoretical underpinnings but the effect is there. This refines that solution by making the unrolling work for an arbitrary number of keywords in each language.
🏷️ What kind of change is this?
♻️ Anything particular you want feedback on?
📋 Checklist: