Is It Inlined?

Sign in to queue

Description

Today's Visual Studio Extension from Stephan Zehetner is of a kind that I don't think I've seen before, and while it's not open source, or even source available,  (it's now available on GitHub, szehetner/InliningAnalyzer) its uniqueness and cool factor make it an easy share...

Inlining Analyzer

Want to know if a method will be inlined by the JIT Compiler? Inlining Analyzer highlights all method calls right in the source code and also displays the reason for a failed inline as given by the JIT Compiler.

Inlining Analyzer highlights all method calls in the source code depending on if the will be inlined (green) or not (red) and displays the reason for a failed inline as given by the JIT Compiler.

image

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, ...

How do I run it? ...
How does it work?

When you run the Inlining Analyzer through the menu it builds your project, loads the resulting assembly into a separate 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? ...
Why is a File Open dialog box displayed after I run the Analyzer? ...
Known Issues (will be addressed in future releases): ...

[Download it here]



The Discussion

Add Your 2 Cents