-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Use single-char variant of String.indexOf() where possible #105205
Conversation
indexOf(char) is more efficient than searching for the same one-character String.
Pinging @elastic/es-core-infra (Team:Core/Infra) |
buildkite test this |
Thanks for the PR ! Could you please fix formatting? (see https://github.com/elastic/elasticsearch/blob/main/CONTRIBUTING.md#formatting ) I will let the Core team review this PR to also comment on the performance of using a char vs a string. |
buildkite test this |
Looking at the code in Java's |
@elasticsearchmachine update branch |
buildkite test this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks good and tests pass. I'm going to merge.
indexOf(char)
is more efficient than searching for the same one-character String.