-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Vectorize Guid equality. #66889
Vectorize Guid equality. #66889
Conversation
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @dotnet/area-system-runtime Issue DetailsI was looking into some of the new Vector capabilities and came across this potential use-case. Using BenchmarkDotNet on my machine (Win 10 x64 Ivy bridge) this results in a ~75% speedup vs. the current approach whether or not the Guids are equal.
|
For reference: #53012 (comment) |
Nice. Is this ready for review? Could you share the benchmark numbers you gathered? |
@danmoseley I had created as a draft since I wanted to see if this triggered any CI failures. I ran some ad-hoc benchmarks but I plan go through the suggested benchmarking workflow and update with the numbers from that before removing the draft tag. Given the suggestions on unaligned reads I'll want to rerun my numbers anyway in case that affects things. Update: ready now, benchmarks posted. |
Feedback from dotnet#66889 (comment) Co-authored-by: Jan Kotas <[email protected]>
I should've caught that the CI run was slightly out of date. The removal of I have a fix up here: #68494 |
Improvements seen on windows arm64: dotnet/perf-autofiling-issues#4993 |
I was looking into some of the new Vector capabilities and came across this potential use-case.
When I originally benchmarked this change I was using a copy of the current EqualsCore method compared to the new method on .NET 6. There I saw substantial improvement (75%) on both the equal and not equal cases. However, with the dotnet/performance repo running directly against my local build of corerun.exe the results are much less impressive:
Before
After
Benchmark Info
Is it worth it?
This shows EqualsSame improving by 36%, while EqualsDifferent gets worse by 32%. This makes sense because the previous implementation would short-circuit if the first 32 bits didn't match.
I'm curious which case matters more. For
Guid
s used as dictionary keys, I'd think that EqualsSame should dominate. Are there other common scenarios for equatingGuid
s?