cucumber / cucumber-expressions

Human friendly alternative to Regular Expressions
MIT License
148 stars 51 forks source link

[Java] Improve cucumber expression creation performance #202

Closed jkronegg closed 1 year ago

jkronegg commented 1 year ago

🤔 What's changed?

Improved CucumberExpression.escapeRegex(String) performance as proposed in https://github.com/cucumber/cucumber-expressions/issues/200. Calls to escapeRegex are about 7 times faster and the overall performance improvement on CucumberExpression new instance is about 7%.

⚡️ What's your motivation?

Fixes #200

🏷️ What kind of change is this?

♻️ Anything particular you want feedback on?

Unit tests have been executed on the previous implementation and proposed implementation to prevent regressions.

📋 Checklist:

jkronegg commented 1 year ago

Hi @mpkorstanje, is anything missing in the PR ? Should I provide more information about the algorithm ?

mpkorstanje commented 1 year ago

No I'm just backlogged for a bit.

mpkorstanje commented 1 year ago

@jkronegg would you be interested in helping out with https://github.com/cucumber/cucumber-jvm/pull/2542. It will eventually enable us to discover all step definitions once, and because of that build all cucumber expressions once (per language) which should significantly improve performance. Though I can imagine that a larger contribution with a longer commitment isn't quite what you are looking for, so if you'd decline that is perfectly understandable.

jkronegg commented 1 year ago

@jkronegg would you be interested in helping out with cucumber/cucumber-jvm#2542. It will eventually enable us to discover all step definitions once, and because of that build all cucumber expressions once (per language) which should significantly improve performance. Though I can imagine that a larger contribution with a longer commitment isn't quite what you are looking for, so if you'd decline that is perfectly understandable.

@mpkorstanje sorry for the long response delay. My employer (https://www.mobiliere.ch/) allows me to work up to 10% of my labor time for the Cucumber framework. I still need to manage the details, but I will be happy to help the Cucumber community.

mpkorstanje commented 1 year ago

Cheers. I'll see if I can write something up to help you get started. I'm unfortunately a bit short on time at the moment.