-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
After noticing a very important impact on string comparison algorithms while sorting a list of business objects, I decided to run a benchmark to analyze the differences between Linux and Windows.
The code is here: https://github.com/sebastienros/stringbenchmarks/blob/master/Startup.cs
Result:
| Description | RPS |
|---|---|
| Linux - CompareTo | 147,252 |
| Linux - CompareOrdinal | 317,025 |
| Windows - CompareTo | 293,785 |
| Windows - CompareOrdinal | 364,015 |
CompareTo is expected to be slower that CompareOrdinal and I am not questioning that, but on Linux the ratio is 46% while on Windows it's 86%. This could have a significant impact on ASP.NET that uses it extensively. In the TechEmpower Fortunes scenario, on our 12 Cores machine we noticed using a performance by a factor of 3 while sorting the results using ordinal comparison (70K RPS to 216K RPS), so the impact seems to be even bigger than these micro benchmark differences.