Improve performance of Enum.CompareTo (#37845)
authorJan Kotas <jkotas@microsoft.com>
Mon, 15 Jun 2020 20:42:50 +0000 (13:42 -0700)
committerGitHub <noreply@github.com>
Mon, 15 Jun 2020 20:42:50 +0000 (13:42 -0700)
commitf05ebc894ba8d09a21a638cf928742d9fae3a56e
tree7a41b575cf0829e2cc9b1712587faf8565ad0c40
parent2e75b8fab806a1fe544846554773756d1c758dec
Improve performance of Enum.CompareTo (#37845)

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 https://github.com/DrewScoggins/performance-2/issues/525
src/coreclr/src/jit/compiler.h
src/coreclr/src/jit/gentree.cpp
src/coreclr/src/vm/methodtable.inl
src/coreclr/src/vm/reflectioninvocation.cpp