Delegates are poorly inlined and optimized #63425
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
tenet-performance
Performance related issue
untriaged
New issue has not been triaged by the area owner
C# Code
Example without using delegate
Example with delegate
Analysis
See [sharplab example](https://sharplab.io/#v2:EYLgxg9gTgpgtADwGwBYA0AXEBDAzgWwB8ABAJgEYBYAKGIGYACMhgYQYG8aHunGBLAHYYGAQQAmY4gFYAFIOHY0DeQ2ABKDlx7biAdgbYGAalUBuLdwC+FhjfrKhDACIwANjADm2DDGlzHig7C6prU2jpSADzySjFBAHwMMAwAvAxibp7eMP7CYLGOYhqcYeFlegbGZjbalual5fo5ger1tTSWQA===
Stopwatch benchmark without Benchmark.NET
On the one hand, of course, all the code to instantiate a delegate function is created, however, the actual code executed is also very poorly optimized.
Assembly result
AddFunc
Content of Func<int, int, int>
The text was updated successfully, but these errors were encountered: