You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The impact is that on a project with ~150 teststeps and ~400 test scenarios, the feature parser uses 0.68% of the total CPU time in the StringUtils.trim() method (about 50 ms). That's not a lot, but the still worth the investment effort.
✅ What did you expect to see?
I expect the performance StringUtils methods to run faster. It's easy to do so by precompiling the Pattern :
Method
Description
ops/s
StringUtilsBenchmark.trim0
original version
1'162'751 ± 74'322
StringUtilsBenchmark.trim1
precomputed Pattern.compile
3'861'664 ± 87'344
📦 Which tool/library version are you using?
Cucumber 7.10.1
🔬 How could we reproduce it?
Steps to reproduce the behavior:
Create a Maven project with the following dependencies:
👓 What did you see?
There are performance issues in https://github.com/cucumber/gherkin/blob/main/java/src/main/java/io/cucumber/gherkin/StringUtils.java because the
String.replaceAll
method used in theStringUtils
class makes a newPattern.compile
at every call.The impact is that on a project with ~150 teststeps and ~400 test scenarios, the feature parser uses 0.68% of the total CPU time in the
StringUtils.trim()
method (about 50 ms). That's not a lot, but the still worth the investment effort.✅ What did you expect to see?
I expect the performance
StringUtils
methods to run faster. It's easy to do so by precompiling thePattern
:Pattern.compile
📦 Which tool/library version are you using?
Cucumber 7.10.1
🔬 How could we reproduce it?
Steps to reproduce the behavior:
Create a Maven project with the following dependencies:
Run the JMH benchmark from
gherkin.zip
The text was updated successfully, but these errors were encountered: