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

Regex patterns should not be created needlessly #30

Closed
agabrys opened this Issue Jun 17, 2018 · 0 comments

Comments

1 participant
@agabrys
Member

agabrys commented Jun 17, 2018

The java.util.regex.Pattern.compile() methods have a significant performance cost, and therefore should be used sensibly.

Moreover they are the only mechanism available to create instances of the Pattern class, which are necessary to do any pattern matching using regular expressions. Unfortunately that can be hidden behind convenience methods like String.matches() or String.split().

It is therefore somewhat easy to inadvertently repeatedly compile the same regular expression at great performance cost with no valid reason.

@agabrys agabrys added the bug label Jun 17, 2018

@agabrys agabrys added this to the 2.0.2 milestone Jun 17, 2018

@agabrys agabrys self-assigned this Jun 17, 2018

agabrys added a commit that referenced this issue Jun 17, 2018

agabrys added a commit that referenced this issue Jun 17, 2018

agabrys added a commit that referenced this issue Jun 17, 2018

#30 Regex patterns should not be created needlessly
* use static regex variables
* upgrade plugins and dependencies

@agabrys agabrys closed this Jun 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment