Slow delegate creation

I upgraded ReSharper and seeing an error that I was not present previously. I checked around, but found nothing about the error or the underlying issue it is flagging.

** Edit **: as pointed out below, it is actually the 'Heap Allocation Viewer' plugin, not ReSharper itself that is marking it as an error -- though that doesn't change the question itself.

Slow delegate creation: from interface 'IPluginHandler' method

this occurs during the subscription of a plugin handler to events on an event aggregator.

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

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

To be clear, this is a ReSharper 'soft error' as the code will still build and run as expected.

So my question is what is the underlying issue the good people at JetBrains are flagging for me and what are the ramifications of it.

Thanks


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

The reply there says this:

Hi! This plugin also has one more internal feature: code inspection to show 'slow' (>10x slower) delegate instance creations for CLR x86 JIT. You can run this test (it creates delegates from various kinds of methods – virtual/interface/generic/etc) to see the difference in delegate creation performance.

Just as with allocations inspection – you shouldn't care about this much until some performance snapshot in some hot path of your application shows long invocations of CLR internals. And just like with allocations – this inspections may (and will) produce false positives with new RuyJIT, for example.

Note that the linked test highlights the "slow" delegation creations with an arrow comment: <-- .

链接地址: http://www.djcxy.com/p/82082.html

上一篇: 检测异常是否为损坏的状态异常

下一篇: 慢委托创建