-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Improve performance of Enum.CompareTo #37845
Conversation
Enum.CompareTo was rewritten in C# recently. This set of fixes gets the performance on par with the previous C++ implementation - Add optimization for obj1.GetType() == obj2.GetType() pattern the JIT - Optimize FCall used by Enum.CompareTo Fixes DrewScoggins/performance-2#525
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Did you try running diffs?
|
Moved this issue to the runtime repo for posterity: #39740 |
Do you have benchmark times before and after this PR? |
Sorry, I forgot the paste the throughput numbers into the PR. It was within noise range (<5%) of the baseline. @DrewScoggins Are there official perf numbers with this fix available? |
You can see the improvement after @jkotas checkin below. |
Enum.CompareTo was rewritten in C# recently. This set of fixes gets the performance on par with the previous C++ implementation
Fixes DrewScoggins/performance-2#525