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:
Minkyu Park
2026-01-07 14:37:54 +01:00
committed by Brian Clozel
parent 9ef4ceb047
commit 1240962d68
@@ -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;
}
}