Skip to content
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: Improve text trimming performance #85

Merged
merged 7 commits into from
Jan 3, 2023

Conversation

jkronegg
Copy link
Contributor

🤔 What's changed?

Precompiled the Pattern used in the utility methods.

⚡️ What's your motivation?

Performance improvement (e.g. StringUtils.trim() is more than 3 times faster).
Fixes #84

🏷️ What kind of change is this?

  • 🏦 Refactoring/debt/DX (improvement to code design, tooling, documentation etc. without changing behaviour)

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

Precompiled trimming patterns for better performance and merged patterns for `trim()` method.
Inspired by the PHP version.
Added unreleased Fixed entry.
Corrected bad class name
@mpkorstanje mpkorstanje self-assigned this Dec 30, 2022

public class StringUtilsTest {
private static final String WHITESPACE = "\u00A0 \t";
private static final String CUCUMBER = "🥒";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆

@mpkorstanje mpkorstanje changed the title Improve text trimming performance java: Improve text trimming performance Jan 3, 2023
@mpkorstanje mpkorstanje merged commit 165ab85 into cucumber:main Jan 3, 2023
@jkronegg jkronegg deleted the patch-1 branch January 5, 2023 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

java: bad performance in StringUtils
2 participants