There’s some pretty impressive performance improvements in .NET 6 when we are comparing arrays using the LINQ SequenceEqual method.
The benchmarks below show that on my machine comparing two int arrays of 10K elements was 94 times faster in .NET 6 compared to .NET 5. We can see that there is also impressive improvements when we are comparing string arrays and arrays of complex types.
Click the image for a larger view in a new tab…
If you’re unfamiliar with the LINQ SequenceEqual method check out the page below for some really clear (and runnable) examples which should help you understand when it will return true or false…
SequenceEqual – LINQ Equality Operator (tutorialsteacher.com)
Note… the StudentComparer class is here if you wish to view it.
Need Help with Your C# Projects?
We offer expert support and development services for projects of any size. Contact us for a free consultation and see how we can help you succeed.
CONTACT US NOW