mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Optimize single-char wildcard path matching performance
Use lazy evaluation in SingleCharWildcardedPathElement to avoid unnecessary Character.toLowerCase() calls. Resolves performance TODO from 2017. Closes gh-36095 Signed-off-by: Minkyu Park <rb6609@naver.com>
This commit is contained in:
committed by
Brian Clozel
parent
9ef4ceb047
commit
1240962d68
+5
-2
@@ -85,8 +85,11 @@ class SingleCharWildcardedPathElement extends PathElement {
|
||||
else {
|
||||
for (int i = 0; i < this.len; i++) {
|
||||
char ch = this.text[i];
|
||||
// TODO revisit performance if doing a lot of case insensitive matching
|
||||
if ((ch != '?') && (ch != Character.toLowerCase(value.charAt(i)))) {
|
||||
char valCh = value.charAt(i);
|
||||
if (ch == valCh || ch == '?') {
|
||||
continue;
|
||||
}
|
||||
if (ch != Character.toLowerCase(valCh)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user