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

Use String.equals() in LiteralPathElement #30138

Conversation

yuzawa-san
Copy link
Contributor

@yuzawa-san yuzawa-san commented Mar 18, 2023

String.equals() eventually calls StringLatin1.equals() which uses processor-specific intrinsics. They are available for major architectures and typically use some sort of processor-optimized vector operations, which should be faster than the current for-loop.

Before:
image

After:
image

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 18, 2023
@yuzawa-san yuzawa-san force-pushed the LiteralPathElement-string-equals branch from 5388fc8 to d50525d Compare March 18, 2023 22:01
@sbrannen sbrannen added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement labels Mar 19, 2023
@poutsma poutsma self-assigned this Mar 21, 2023
@poutsma poutsma added this to the 6.0.8 milestone Mar 22, 2023
@poutsma poutsma removed the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 22, 2023
@poutsma
Copy link
Contributor

poutsma commented Mar 22, 2023

I changed the PR to remove the char[] field in favor of the String, as both contain the same information.

I then ran our JMH PathMatchingBenchmark against this PR, and it does look like it increases the operations/second, while not significantly increasing memory usage. So I am going to merge this PR for 6.0.8.

@poutsma poutsma closed this in c68e986 Mar 22, 2023
poutsma added a commit that referenced this pull request Mar 22, 2023
…quals

* gh-30138:
  Polish external contribution
  Use String.equals() in LiteralPathElement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants