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

Simplify IndexOfAnyAsciiByteValues for needles with 0 on X86 #82866

Merged

Conversation

MihaZupan
Copy link
Member

IndexOfAnyLookupCore already discards non-ASCII byte values.
We have to do this special-casing of 0 for char inputs because of how we pack the source on X86, but it's redundant when dealing with byte inputs where we do no such packing.

@stephentoub this will further improve your change in #82789 that hits this case.
For values that contain 0:

Method Toolchain Length Mean Error Ratio
IndexOfAny_Byte main 1000 36.95 ns 0.127 ns 1.00
IndexOfAny_Byte pr 1000 30.12 ns 0.048 ns 0.81
IndexOfAnyExcept_Byte main 1000 39.75 ns 0.134 ns 1.00
IndexOfAnyExcept_Byte pr 1000 32.48 ns 0.054 ns 0.82
LastIndexOfAny_Byte main 1000 37.09 ns 0.088 ns 1.00
LastIndexOfAny_Byte pr 1000 30.42 ns 0.062 ns 0.82
LastIndexOfAnyExcept_Byte main 1000 39.67 ns 0.127 ns 1.00
LastIndexOfAnyExcept_Byte pr 1000 31.98 ns 0.269 ns 0.81

@MihaZupan MihaZupan added this to the 8.0.0 milestone Mar 1, 2023
@MihaZupan MihaZupan requested a review from stephentoub March 1, 2023 23:45
@MihaZupan MihaZupan self-assigned this Mar 1, 2023
@ghost
Copy link

ghost commented Mar 1, 2023

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

Issue Details

IndexOfAnyLookupCore already discards non-ASCII byte values.
We have to do this special-casing of 0 for char inputs because of how we pack the source on X86, but it's redundant when dealing with byte inputs where we do no such packing.

@stephentoub this will further improve your change in #82789 that hits this case.
For values that contain 0:

Method Toolchain Length Mean Error Ratio
IndexOfAny_Byte main 1000 36.95 ns 0.127 ns 1.00
IndexOfAny_Byte pr 1000 30.12 ns 0.048 ns 0.81
IndexOfAnyExcept_Byte main 1000 39.75 ns 0.134 ns 1.00
IndexOfAnyExcept_Byte pr 1000 32.48 ns 0.054 ns 0.82
LastIndexOfAny_Byte main 1000 37.09 ns 0.088 ns 1.00
LastIndexOfAny_Byte pr 1000 30.42 ns 0.062 ns 0.82
LastIndexOfAnyExcept_Byte main 1000 39.67 ns 0.127 ns 1.00
LastIndexOfAnyExcept_Byte pr 1000 31.98 ns 0.269 ns 0.81
Author: MihaZupan
Assignees: MihaZupan
Labels:

area-System.Memory

Milestone: 8.0.0

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

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

Nice

@MihaZupan
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

2 participants