Visual Studio 2015 has been with us for a few months so far, and we had the change to tinker a bit with its improvements over the previous versions. One of the newest toys is the remade “Performance and Diagnostics” hub, which enhances the 2013’s version with CPU and Memory use dynamically-generated graphs, and access to this feature while debugging, among plenty other upgrades.
Visual Studio will bring this window up by default when we enter into debug mode, showing a general overview of our project’s performance. We can see a couple of graphs indicating Memory usage and overall CPU consumption.
As well, the “Events” timeline shows relevant information to our execution, such as the time slot that it took a single step to be completed, important events registered, or information related to exceptions generated on this session.
These three tools gives us the big picture of “what” is happening in our code, but sometimes we may have the need of going deeper to find the root cause of a memory leak, or an unusual processing power waste. For that, we can take a memory snapshot.
For each snapshot generated, a small breakdown appears in the data grid under the tab “Memory usage”. Clicking on it will bring us to a full rundown, as shown in the next figure.
The data is shown ordered by the value “Count” by default, but we can rearrange it easily. Clicking on a given row shows specific information on the object type, references and path.
Debugger-integrated performance tools is definitely a step forward in one of the most popular IDEs, and empowers the developer with a gadget that can evaluate the written code’s efficiency.
Written by Álvaro G. Cachón