PerfTips – How many times have you written timer code to see how long a certain method takes to execute? Perhaps you have a bit of reusable code that you can just plug in to do this. Well stash away that old timer code because as of today with the release of Visual Studio 2015, Microsoft has introduced PerfTips.
PerfTips To The Rescue
So how easy is it to use this new feature? Extremely easy if you know how to set a breakpoint (you need to set two actually). To illustrate the use of perftips, I created a method that simulated a task that takes a few seconds (5 seconds in fact). What you need to do is set a breakpoint on this method. Then you set a second breakpoint just after this method. When you debug your code, the execution will pause at your first breakpoint. Just hit F5 to run to the next breakpoint.
When your next breakpoint is hit, you will notice the perftip displayed. This now shows you how many milliseconds elapsed while the previous method’s code was being executed.
You can now go ahead and click on this perftip to open the Diagnostic Tools that will give you more information such as the CPU usage etc.
Why is this such a cool feature? For me it would be great to see which sections of code take the longest to run. This feature will allow me to be able to test the execution time of certain sections of my code on the fly as I debug. I can now identify problem areas easily and efficiently.
Visual Studio has come a long way since I started using it. It is truly a tool for serious professional developers that need to write good software. Visual Studio 2015 raises the bar once again on IDE’s.
For a more in-depth video on PerfTips, head on over to Channel 9 and watch Dan Taylor’s video: PerfTips: Performance Information At-a-Glance While Debugging.