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

Improve the efficiency of UrlPathHelper.getSanitizedPath() #27623

Closed
wants to merge 1 commit into from

Conversation

happyWilliam0
Copy link
Contributor

@happyWilliam0 happyWilliam0 commented Oct 29, 2021

Hi,

Tiny optimization is possible using the new method (time complexity : O(N)) instead of the old one (time complexity : O(N^2)).

Cheers,
William

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 29, 2021
@rstoyanchev rstoyanchev self-assigned this Oct 29, 2021
@rstoyanchev rstoyanchev added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 29, 2021
@rstoyanchev rstoyanchev added this to the 5.3.13 milestone Oct 29, 2021
@sbrannen sbrannen changed the title Improve the efficiency of method (getSanitizedPath) and add a test case of it. Improve the efficiency of UrlPathHelper.getSanitizedPath() Oct 29, 2021
@rstoyanchev
Copy link
Contributor

The change helps more, the more duplicate slashes there are. However, for the happy scenario, which should be the most common case, it adds object allocations. I've updated the change to restore the initial check for the presence of duplicate slashes, and then continue from there if necessary.

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.

None yet

3 participants