-
Notifications
You must be signed in to change notification settings - Fork 4.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
Improvements for SpanHelpers.IndexOf #64872
Conversation
Tagging subscribers to this area: @dotnet/area-system-memory Issue DetailsAttempt to fix regressions caused by #63285 for large input: #64381
Benchmarks: (Regressed ones and the ones from #63285)
No changes for cc @stephentoub
|
NOTE: there is still a room for improvement, e.g. use the trick used in IndexOfAny - do the last iteration separately and it will allow us to remove a condition from the main loop. |
@EgorBo the pattern here of branching back to (context: #87194 (comment)) |
That was sort of hand-written PGO and can be simplified now, although, NativeAOT might slightly regress |
Attempt to fix regressions caused by #63285 for large input: #64381
nint
instead ofint
where possible to avoid sign extensionssearchSpaceMinusValueTailLength - Vector128<ushort>.Count
expression - JIT only does it for natural loops so I had to do it by hands.cmpCh1
andcmpCh2
- it slightly improves pipelining (currently we emit a GPR instruction between two independent SIMD compare instructions)Benchmarks: (Regressed ones and the ones from #63285)
No changes for
LastIndexOf
for now (we also don't have reported regressions for it atm)cc @stephentoub