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

Tweak Invariant IndexOf logic #108709

Merged
merged 2 commits into from
Oct 9, 2024
Merged

Conversation

MihaZupan
Copy link
Member

@MihaZupan MihaZupan commented Oct 9, 2024

Follow-up after #108499
Contributes to #108669

Reverts the change on the case-sensitive path, and changes the ignore-case path to create the remainingSource slice only when it's needed. This takes away some overhead when we do find a match, and avoids having to keep the extra state around during the main loop.

Example change:

Method Toolchain input value comparisonType Mean Error Ratio
IndexOfString Main AAAAAAAAAAAA(...)AAAAAAAAAAAA [100] x InvariantCultureIgnoreCase 195.51 ns 0.294 ns 1.00
IndexOfString PR AAAAAAAAAAAA(...)AAAAAAAAAAAA [100] x InvariantCultureIgnoreCase 173.39 ns 0.200 ns 0.89
IndexOfString Main ABCDE c InvariantCultureIgnoreCase 19.07 ns 0.066 ns 1.00
IndexOfString PR ABCDE c InvariantCultureIgnoreCase 18.10 ns 0.031 ns 0.95

MihuBot/runtime-utils#710
MihuBot/runtime-utils#711

@MihaZupan MihaZupan added this to the 10.0.0 milestone Oct 9, 2024
@MihaZupan MihaZupan requested a review from tarekgh October 9, 2024 13:13
@MihaZupan MihaZupan self-assigned this Oct 9, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-globalization
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@tarekgh tarekgh left a comment

Choose a reason for hiding this comment

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

Thanks @MihaZupan for your help with this issue!

@tarekgh tarekgh merged commit e8e3e14 into dotnet:main Oct 9, 2024
146 of 148 checks passed
@tarekgh
Copy link
Member

tarekgh commented Oct 9, 2024

/backport to release/9.0

Copy link
Contributor

github-actions bot commented Oct 9, 2024

Started backporting to release/9.0: https://github.com/dotnet/runtime/actions/runs/11262961938

@tarekgh
Copy link
Member

tarekgh commented Oct 9, 2024

/backport to release/8.0-staging

Copy link
Contributor

github-actions bot commented Oct 9, 2024

Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/11262967394

rzikm pushed a commit to rzikm/dotnet-runtime that referenced this pull request Oct 11, 2024
@radekdoulik
Copy link
Member

Nice! This improved the performance on wasm
image

@github-actions github-actions bot locked and limited conversation to collaborators Nov 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants