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

Consider caching the compiled pattern in OperatorMatches [SPR-12610] #17211

Closed
spring-issuemaster opened this issue Jan 9, 2015 · 1 comment

Comments

@spring-issuemaster
Copy link
Collaborator

commented Jan 9, 2015

Gary Russell opened SPR-12610 and commented

OperatorMatches invokes Pattern.compile() on the right operand on every invocation. This could be relatively expensive, especially with a complex regex, even with compiled SpEL.

In many cases, the regex will be a literal.

Consider caching (at least) the most recent compiled Pattern and reuse it if the right operand matches.


Affects: 4.1.4

Reference URL: http://stackoverflow.com/questions/19742528/spel-how-does-matches-work

Referenced from: commits d34402d, 87b7cd6

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 20, 2015

Juergen Hoeller commented

Good point! We're caching all compiled patterns for each given 'matches' expression now.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.