Inlining Analyzer highlights all method calls in the source code depending on if they will be inlined (green) or not (red) and displays the reason for a failed inline as given by the JIT Compiler. Release HistoryVersion 0.7.10, 2019/10/11:
What is Inlining and why should I care?Inlining is a compiler optimization that replaces a function call site with the body of the callee. In the Common Language Runtime, this is done by the JIT Compiler. For performance-critical code, it can be important to know if a method will be inlined or not. More Inlining is usually better, but not always. If you tweak your code the get a method to be inlined, always use a Profiler or a benchmarking library to test if it really does make a difference for your scenario. Unfortunately it is not possible to determine if a method will be inlined or not from the source code alone, as the decisions of the JIT compiler not only depend on some clear-cut rules (e.g. no exception handling within the method) but also on information that is only available at runtime (like the native code size of a method). Therefore it is not easy to find out if a method will be inlined. Usually this is done by running the application and either tracing and interpreting ETW events manually or by looking at the compiled native code with a debugger. Both options are not exactly convenient, therefore Inlining Analyzer saves you from doing all this work manually. How do I run it?In the Visual Studio main menu select Tools -> Inlining Analyzer -> "Run Inlining Analyzer on Current Project". (Analyzes all types and methods in the project) or In the context menu inside a method select "Run Inlining Analyzer on Current Scope". (Depending on the cursor position analyzes only the current method or the methods in the current type) How does it work?When you run the Inlining Analyzer through the menu it builds your project, loads the resulting assembly into a seperate process, forces a JIT compilation of all methods and collects the ETW trace events emitted by the JIT Compiler. The information gathered from these events (inlining succeeded/failed, the reason and the IL size) is then mapped onto the corresponding method calls in the source code editor. Inlined methods are highlighted green, not inlined methods red and the tooltip of the method contains the fail reason and IL size (if available). Can I change the colors for the highlighting?Of course, just search for "Inlining Analyzer" in the "Fonts and Colors" options page: Known Issues (will be addressed in future releases):
|