Repository navigation
Better performance for MulticastDelegate.Equals - #6113
Conversation
|
The actual delegate types inherit from MulticastDelegate, not Delegate. If you would like to improve the fast path for comparing identical delegate instances, it should be better done in MulticastDelegate.Equals. Results from a small microbenchmark would be nice. |
|
@jkotas I see. I googled about If
|
|
Here are the numbers for the new I added a For the delegates being reference-equal, there is a 10x speedup. |
What about when they're not? |
I'm confused. Comparing the old and new results you posted, reference equality looks appx the same between them, and method equality appears to regress 10%. What am I misunderstanding? |
|
@stephentoub Whoops! Looks like I was actually testing the new code twice, I looked at the wrong copy of |
|
I've updated the old results. It looks like the new changes actually do make it 10x faster, and have a 10% improvement for the method equality case. |
There was a problem hiding this comment.
The GetType JIT intrinsic is only optimized in specific usage patterns. This is not one of them.
There was a problem hiding this comment.
@jkotas I removed the TODO. (It seems kinda unintuitive that you have to define a new function/ P/Invoke to get faster performance than what's written 99% of the time, but whatever.)
|
LGTM. Thanks! |
|
@jamesqo Could you please make a matching fix in CoreRT as well? |
Better performance for MulticastDelegate.Equals Commit migrated from dotnet/coreclr@a8cdb48
cc: @jkotas