Refactor FastEquals to use SIMD-accelerated SequenceEquals#36
Merged
RevenantX merged 1 commit intoRevenantX:masterfrom Mar 8, 2026
Merged
Refactor FastEquals to use SIMD-accelerated SequenceEquals#36RevenantX merged 1 commit intoRevenantX:masterfrom
RevenantX merged 1 commit intoRevenantX:masterfrom
Conversation
Contributor
Author
|
@RevenantX Do I need to add a |
Owner
|
Strange that its faster because when i checked benchmarks SequenceEquals was slower. Maybe depends on structure size or Mono/.Net |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the FastEquals method to use the SequenceEquals method for faster comparison. The SequenceEquals method is apparently SIMD-enabled and should have better performance, especially for larger struct objects.
Here are the benchmark results I got:
This uses a large struct (12 longs) to measure the difference in perf. It's pretty significant the larger your input data.
Here's the source for the benchmark: Benchmark.txt
I also tested with a very small struct (3 ints) but couldn't really find a measurable difference at that size.