Slow delegate creation

I updated ReSharper and saw an error that I had not previously attended. I checked, but did not find anything about the error or the main problem that it puts.

** Edit **: as indicated below, this is actually the Kitchen Browser plugin, not ReSharper itself, which marks it as an error - although this does not change the question itself.

Slow delegate creation: from the IPluginHandler Method interface

this happens when the plugin handler subscribes to events in the event aggregator.

public void Subscribe(IPluginHandler subscriber) { Executing += subscriber.OnExecuting; // -- additional subscriptions -- } 

in the above code, Executing is the event, and subscriber.OnExecuting is the corresponding event handler for the event.

To be clear, this is a “soft mistake” by ReSharper, because the code will still build and run as expected.

So my question is what is the main problem that good people at JetBrains have noted for me and what are its implications.

thanks

+7
c # delegates resharper
source share
1 answer

This JetBrains blog post has the same question in a comment.

In response, it says:

Hello! This plugin also has another internal function: code checking to show the “slow (> 10x slower) delegate instance creation for the x86 JIT CLR. You can run this test (it creates delegates from various methods - virtual / interface / generic / etc) to see the difference in delegate creation performance.

As with distribution checking, you shouldn't have to worry about this until some performance snapshot in some hot path of your application shows long calls inside the CLR. And in the same way as in the distribution - these checks can (and will) create false positives using the new RuyJIT, for example.

Note that the linked test highlights the “slow” creation of delegations with arrow comment: <-- .

+4
source share

All Articles