Faster C++ build cycle in VS 2017 with /Debug:fastlink

Continuing with our goal of further improving developer productivity with Visual Studio 2017 there have been major investments made for also improving incremental developer builds. The developer incremental build is one where a developer changes a single or multiple source files and builds. The time spent in these builds is almost equal to the time spent in linking the binaries. With Visual Studio 2015 we introduced a new linker switch ‘/debug:fastlink’. With ‘/debug:fastlink’ developers on average see an improvement of 2-4x in clean link times.

So why is /debug:fastlink so much faster for link times?

Well, with /debug:fastlink the linker-produced PDB doesn’t have any private symbol information. Debug information is distributed among input object and library files, and the linker PDB just serves as an indexing database. While this provides a huge performance benefit for the daily developer builds, there is one scenario you will need to handle differently, and that is when you want to share the linker PDB with another developer on the team or upload the linker PDB’s directly to symbol server. There have been requests for tooling which is able to create a full PDB from the /debug:fastlink PDB on demand and with this release we are doing just that. Developers will now be able to generate a full PDB from a /debug:fastlink PDB both at a solution, project level using the new options shown in the figures below:

fastlink

If you would like to integrate this from a command line flow. The binary tool is called ‘mspdbcmf.exe’ and available under this path ‘Microsoft Visual Studio 14.0\VC\bin’.

mspdbcmf

/Debug:fastlink now default setting for new and existing projects (Debug Configuration)

Another issue with using /debug:fastlink is its lack of discoverability and today developers need to play around with linker property pages to discover this feature. Starting with Visual Studio ‘15’ /debug:fastlink will serve as the default program database file generation setting for new project templates.

In addition to changing the default setting for program database file generation, with this release we are also changing the definition of the existing program database generation linker flag:‘/debug’ to map to ‘/debug:fastlink’ for the ‘Debug’ configuration in Visual Studio.

This will allow us to migrate all existing Visual Studio developers to use /debug:fastlink by default. Developers can opt-out of this behavior by adding the ‘/debug:full’ linker switch to linker command line or by enabling the ‘Generate Full Program Database File’ as shown in the property page below.

props

We missed the opportunity to unify ‘Generate Debug Info’ and ‘Generate Full program Database File’ for this setting but will be doing so for the upcoming release.

Another thing we would like to share on this front is that in Visual Studio “15” we are working on further improving /debug:fastlink by moving name hash building from link time to DIA (or debug) time. There is a small increase in time taken for first name lookup related debugging actions (like function/data lookup by name for expression evaluation in watch windows) but it’s only noticeable for very large binaries (>50 Mb). The figure below highlights the link time improvements you will obtain with /debug:fastlink over /debug in the next update for Visual Studio “15”.

bp

Wrap Up

As always, we welcome your feedback and we would love to learn from your experiences as you try these features out. Do let us know if you run into any issues trying out /debug:fastlink or fail to see any link speed improvements. You can also email us your query or feedback if you choose to interact with us directly! For new feature suggestions, let us know through User Voice.