-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
Performance issue in StringUtils #361
Comments
Using a regular expression for trim looks very inefficiΓ«nt. It will be applied for every character in line. It might be faster to find the last consecutive whitespace character from the start and end, and then take a substring. |
The left trim, right trim and left+right trim operations are used for indentation purposes. Thus, rather than dumbly improving |
π What did you see?
In the
Parser.parse()
method, 30% to 50% of the elapse time is passed doingString
trimming in theStringUtils
class, see #351 (comment)β What did you expect to see?
No doubt
String
trimming is important, but it should not last that long.π¦ Which tool/library version are you using?
OpenJDK21
gherkin 31.0.0 (the main branch)
π¬ How could we reproduce it?
See JMH benchmark code in #351 (comment)
π Any additional context?
Identified for #351
The text was updated successfully, but these errors were encountered: