Build Insights Now Available in Visual Studio 2022

Nelson Daniel Troncoso

Introduction

We’re excited to announce that Build Insights is now integrated with Visual Studio 2022! Available in Visual Studio 2022 17.7 Preview 2, Build Insights provides critical information of your development environment. Using the analysis created by Build Insights, you will now have the power to effectively optimize your build times, especially large projects like AAA games. With Build Insights now integrated with Visual Studio, you will be able to capture your ETL trace and see your build analytics from within Visual Studio with only a few clicks. As a first step, you will be able to use the Include File and Include Tree views to analyze and optimize your #include usage. Additionally, you no longer need to install external components or run vcperf from the command line. Build Insights integration will work for both MSBuild and CMake projects.

We are deeply grateful to everyone, especially our game developer partners, who shared their feedback on Developer Community and during development of Build Insights. Your invaluable feedback has made all this possible.

Getting Started

Build Insights integration is enabled by default in the Visual Studio Installer. You can find C++ Build Insights in the “Desktop development with C++” and “Game development with C++” workloads.

Find Build Insights in the Desktop Development with C++ Installation Workload
Desktop Development with C++ Installation Workload

Find Build Insights in the Game Development with C++ Installation Workload
Game Development with C++ Installation Workload

Capturing Build Insights Trace

To start using Build Insights, first capture a trace by selecting Build from the top menu, followed by either Run Build Insights on Solution, Run Build Insights on [Project_Name], or Run Build Insights on Selection.

A picture of the how to start Build Insights. The menu option is located in the Build Menu.
Build menu for MSBuild projects.

A picture of the how to start Build Insights. The menu option is located in the Build Menu. This is different for CMake projects.
Build menu for CMake projects.

 

When your build is complete, a trace file will automatically pop up in an Editor Window, providing a visual analysis of your build.

 

The Included Files view of the Build Insights analysis window
Build Insights analysis window. In this example, it shows the build profile on an open-source project Irrlicht

 

To save this trace for future reference, go to ‘File’ > ‘Save [Trace].etl As…’.

You can save the trace in the Visual Studio File Menu
Visual Studio File Menu

Parsing Insights with Included Files View

In the Included Files View, you’ll see how each file contributes to the overall build time, determined by the number of times it is parsed. Files that take up 10% or more of the build time will be marked with a flame symbol that indicates priority files for troubleshooting. You can optimize these files using methods like implementing precompiled headers or minimizing unnecessary inclusions. You can refer to this blogpost for a precompiled header optimization.

Image Included Files View
Include Files View: The flame icon indicates that the file might be a bottleneck.

Diving Deeper with Include Tree View

Include Tree View offers a more granular perspective of your project. It presents the #included hierarchy of all the files in the trace, providing a crystal-clear view of your project’s structure and highlighting potential areas for improvement. From any view, you can access the selected file by double clicking, pressing enter, or from the context menu of the selected table entry.

A view of the Include Tree in Build Insights Analysis
Include Tree View: File entries can be expanded to show #included files within that entry.

You can navigate to source files by using the context menu, double-clicking, or pressing Enter in any table entry. Also, for those moments when you want to switch your perspective, we added the “Show in [View]” option. This functionality enables you to seamlessly transition between the Included Files View and Include Tree View.

You can right click on a file in the Included Tree view to navigate to source file
Context Menu: You can navigate to source or go to the associated entry in another view.

Designed for Everyone

One of the main principles guiding the design of Build Insights is the aim to simplify the process of capturing and visualizing information within the same platform. Nevertheless, based on feedback, we know some users still would like to use WPA to go deeper in their investigation. We simplified that workflow by bundling WPA with the C++ workloads and added a button to open the trace directly within Visual Studio.

Open in WPA button is located on the bottom right corner of the Build Insights Analysis window
You can open WPA from within the Build Insights analysis window.

 

To see Build Insights integration in action, please see the following session I recorded for Pure Virtual C++ Conference 2023.

Known Issues

We are aware of a couple of current issues and are actively working to resolve them in the next Visual Studio previews:

  1. (Fixed in 17.7 Preview 3) Incorrect Flame Icons: For certain projects, especially those with a significant number of parallel tasks, flame icons may erroneously appear for files that don’t meet the criteria (files taking up 10% or more of the build time).
  2. Empty Project Column: We acknowledge that this is not the intended behavior. We are currently working on a fix.

Discover More: Functions View

Visual Studio 2022 17.8, we introduced another view that could significantly enhance your build times. The new view is Functions View.  It’s designed to offer insights into functions code generation times and forceinlines. Forceinlines, commonly used to boost runtime efficiency, can also influence build times.

For a detailed exploration of this feature, how it can benefit your projects, and tips on how to make the most of it, be sure to read our dedicated blog post:

Functions View for Build Insights in Visual Studio 2022 17.8

Send us your feedback!

We hope Build Insights helps you by providing the critical information needed to optimize your build times and speed up your build iteration time. Download the latest preview version of Visual Studio and give it a try.

Please let us know your thoughts and what additional capabilities you’d like to see from this feature next! We are actively developing this feature set and would love to hear what would improve your workflow even more. The comments below are open for us to track any requests. You can also find us on Twitter (@VisualC) or via email at visualcpp@microsoft.com. To open a bug, please see Visual Studio Feedback.

0 comments

Discussion is closed.

Feedback usabilla icon