Skip to content

Conversation

@reschke
Copy link
Contributor

@reschke reschke commented Jan 8, 2025

No description provided.

@reschke reschke requested review from mbaedke and rishabhdaim January 8, 2025 19:07
@reschke reschke self-assigned this Jan 8, 2025
@github-actions
Copy link

github-actions bot commented Jan 8, 2025

Commit-Check ✔️

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2025

}
rewritten.append(c);
} else if (Chars.contains(QUERY_OPERATORS, c)) {
} else if (QUERY_OPERATORS.indexOf(c) >= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would convert QUERY_OPERATORS to Set<Character> and then use Set.contains.

Copy link
Contributor

Choose a reason for hiding this comment

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

That would be more expensive. A Set<Character> requires boxing the elements. And a call to Set.contains will box the argument and calculate an hash. A linear search on a character array, as String.indexOf does, uses much less logic per call and will certainly be faster for an array of just 6 elements (all contiguous in memory).

@reschke reschke merged commit 59912f4 into trunk Jan 9, 2025
5 of 7 checks passed
@rishabhdaim rishabhdaim deleted the OAK-11367 branch January 9, 2025 09:15
andreeastroe96 pushed a commit to andreeastroe96/jackrabbit-oak that referenced this pull request Feb 25, 2025
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.

3 participants