-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIoptimization
Milestone
Description
Starting in .NET Core 2.1, calling EqualityComparer<T>.Default.Equals
is specially optimized by the JIT by devirtualizing and inlining the equality check.
However, as seen in SharpLab, the similar Comparer<T>.Default.CompareTo
did not have the same fate. As seen in the generated assembly code, comparing integers with via IComparable<int>
is optimized, but calling Comparer<int>.CompareTo(x1, x2)
results in a function call. Making the two examples generate identical code would be a good optimization opportunity.
category:cq
theme:devirtualization
skill-level:intermediate
cost:small
eiriktsarpalis and airbreather
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIoptimization
Type
Projects
Status
Done