Visual Studio 2015 holds a couple of interesting features for the interested debugger and troubleshooter. This blog post will elaborate on some of the new tools and features in VS2015:
You might already be familiar with the data tips that pop up when you hover over a variable during debugging:
Sidenote: Did you know that you can pin these debugging tips to the canvas by clicking the “pin”symbol? You can even use DEBUG –> EXPORT DATA TIPS to share them with a fellow developer and prove that the bug is his fault.
But back to the perf tips. Perf tips show up automatically during debugging and show you the time that has passed since the last debugger break. You can find them on the right hand side of the line that the debugger is currently breaking on. In the picture below, the debugger stopped on the LoadDevices() method and then proceeded to the yellow line. The perf tip indicates that the execution of LoadDevices() took 5411 milliseconds.
No more need for System.Diagnostics.Stopwatch all around your code!
When clicking the perftip link, visual studio will take you to the brand new diagnostic tools window that records every step the debugger took.
A couple of best practices related to perf tips can be found in this article by the visual studio team: http://blogs.msdn.com/b/visualstudioalm/archive/2014/08/18/perftips-performance-information-at-a-glance-while-debugging-with-visual-studio.aspx
Take multiple measurements: In order to exclude first-call performance degradation due to JIT, caching or loading, you should always take multiple measurements before relying on your numbers.
Verify in release: If you are investigating times below 50ms or anticipating a lot of work in performance optimizations, it is recommended to use Release mode and the tools in the Performance and Diagnostics hub for analysis. As perftips are used during debugging, the debugger itself could (minimally) skew the results.
If you don’t like this new feature, you can always turn perf tips off by going to TOOLS –> DEBUGGING –> “Show elapsed time PerfTip while debugging”.
If you like the feature but are not happy with the color of the text, you can even change the PerfTip color. Follow the instructions here:
Have fun perftipping!