{"id":31318,"date":"2022-11-15T16:00:21","date_gmt":"2022-11-15T16:00:21","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=31318"},"modified":"2023-02-02T19:12:42","modified_gmt":"2023-02-02T19:12:42","slug":"faster-cpp-source-code-indexing","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/faster-cpp-source-code-indexing\/","title":{"rendered":"Visual Studio 2022 Performance: Faster C++ Source Code Indexing"},"content":{"rendered":"<p>Building on top of <a id=\"post-31318-_Int_H4uFQVnC\"><\/a>our <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/vs2022-performance-enhancements-faster-c-development\/\">performance wins<\/a> in Visual Studio 2022 version 17.3, we are excited to announce additional improvements in version 17.4.<\/p>\n<p>Whether you are a game developer, work with large codebases, or have solutions with many C++ projects, your development experience in Visual Studio 2022 17.4 will feel <em>even faster<\/em>.<\/p>\n<p>In 17.4 we significantly reduced the time it takes to open a C++ project for the first time (cold load).<\/p>\n<p>While working on these improvements, we constantly check our performance against real-life large projects, including some of our own, as well as several C++ codebases for popular games from our partner game studios.<\/p>\n<p>Large C++ projects could see a 20-36% speed improvement over 17.3 when populating the source code database used for browsing and navigation.<\/p>\n<p>When compared to VS 2019, the cumulative performance gains for this scenario should be between 2X-6X depending on the project structure and size.<\/p>\n<p>In this post, we want to highlight the C++ project indexing scenario for the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Gears_of_War\">Gears of War<\/a> source code and a generic Unreal Engine 5 starter project.<\/p>\n<h2>Testing Methodology<\/h2>\n<p>Hardware: AMD Ryzen PRO 3945WX 12\/24, 128GB RAM, 2.5TB SSD, RTX 3080<\/p>\n<p>Projects\/source code: Gears of War, Unreal Engine 5 starter project, Chromium<\/p>\n<p>Visual Studio: VS2019 v16.11 and VS2022 v17.4<\/p>\n<p>For all scenarios, we used VS system events\/logs to track the duration of the operations.<\/p>\n<h3>Results<\/h3>\n<p>Let\u2019s see the cumulative effect of all the improvements we made in this area for C++ projects, for the past year.<\/p>\n<p><img decoding=\"async\" width=\"1431\" height=\"1080\" class=\"wp-image-31319\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/chart-bar-chart-description-automatically-genera-1.png\" alt=\"Chart, bar chart Description automatically generated\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/chart-bar-chart-description-automatically-genera-1.png 1431w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/chart-bar-chart-description-automatically-genera-1-300x226.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/chart-bar-chart-description-automatically-genera-1-1024x773.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/chart-bar-chart-description-automatically-genera-1-768x580.png 768w\" sizes=\"(max-width: 1431px) 100vw, 1431px\" \/><\/p>\n<p>In Visual Studio 2019 16.11, it takes roughly <a id=\"post-31318-OLE_LINK1\"><\/a>6\u00bd minutes for Gears of War to fully index. In Visual Studio 2022 17.4, waiting for indexing to finish will only take a bit over <a id=\"post-31318-OLE_LINK2\"><\/a>2\u00bd minutes, resulting in a <strong>2.5X<\/strong> speed up.<\/p>\n<p><img decoding=\"async\" width=\"1431\" height=\"1080\" class=\"wp-image-31320\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/word-image-31318-2.png\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/word-image-31318-2.png 1431w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/word-image-31318-2-300x226.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/word-image-31318-2-1024x773.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/word-image-31318-2-768x580.png 768w\" sizes=\"(max-width: 1431px) 100vw, 1431px\" \/><\/p>\n<p>When getting to code in a new Unreal Engine 5 solution, you will see a huge improvement in the latest version of VS2022 versus VS2019. In VS2019 16.11, fully indexing a brand-new C++ UE5 solution took a bit over 2\u00bd minutes. When using VS2022 17.4, fully indexing the same UE5 solution is now <strong>2.7X<\/strong> faster at just 1 minute. Whether you are creating a new UE5 project or cloning from an existing repo, your code will index much faster in 17.4.<\/p>\n<h3>Pushing the limits<\/h3>\n<p>Few open-source projects reach the scale of <a href=\"https:\/\/chromium.googlesource.com\/chromium\/src.git\">Chromium<\/a> with over 12,000 projects in one single Visual Studio solution, so naturally it\u2019s an irresistible target for stress testing the components we\u2019re improving. Let\u2019s see how we did.<\/p>\n<p><img decoding=\"async\" width=\"1431\" height=\"1080\" class=\"wp-image-31321\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/word-image-31318-3.png\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/word-image-31318-3.png 1431w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/word-image-31318-3-300x226.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/word-image-31318-3-1024x773.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/11\/word-image-31318-3-768x580.png 768w\" sizes=\"(max-width: 1431px) 100vw, 1431px\" \/><\/p>\n<p>In Visual Studio 2019 16.11, it takes roughly 31 minutes for the Chromium repo to fully index. In Visual Studio 2022 17.4, waiting for indexing to finish will only take just 5 minutes, a <strong>6X<\/strong> speed up. When indexing a large solution like the Chromium repo for the first time, you will save up to 26 minutes with the latest version of Visual Studio.<\/p>\n<h3>Try it out<\/h3>\n<p>Although everyone should see considerable improvements for these scenarios, the magnitude of the gains is dependent on your source code, project layout, include graph, etc. So, try it out on your codebase and let us know about your project load\/parsing gains for IntelliSense start-up.<\/p>\n<h2>Feedback Wanted!<\/h2>\n<p>Your feedback through\u00a0<a href=\"https:\/\/developercommunity.visualstudio.com\/\" target=\"_blank\" rel=\"noopener\">Developer Community<\/a>, surveys, and social media channels has made these improvements possible. We thank you for your valuable comments. These enhancements are a continuation of our focus on improving productivity for game developers. Throughout the Visual Studio 2022 development cycle, we will continue to make improvements like ones detailed in this blogpost. If you are a game developer,\u00a0<a href=\"http:\/\/aka.ms\/VSGameDevSurvey\" target=\"_blank\" rel=\"noopener\">let us know your thoughts in our 2022 Visual Studio Game Developer Survey<\/a>.<\/p>\n<p>In addition, please continue to help shape the development of Visual Studio by talking to us in the comments below, on Twitter (<a href=\"https:\/\/twitter.com\/visualc\" target=\"_blank\" rel=\"noopener\">@VisualC<\/a>), or via email at\u00a0<a href=\"mailto:visualcpp@microsoft.com\">visualcpp@microsoft.com<\/a><\/p>\n<h2>Upgrade to Visual Studio 2022<\/h2>\n<p><a href=\"https:\/\/visualstudio.microsoft.com\/downloads\/\" target=\"_blank\" rel=\"noopener\">Download the latest version of Visual Studio 2022<\/a>\u00a0to take advantage of these productivity benefits today!<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Building on top of our performance wins in Visual Studio 2022 version 17.3, we are excited to announce additional improvements in version 17.4. Whether you are a game developer, work with large codebases, or have solutions with many C++ projects, your development experience in Visual Studio 2022 17.4 will feel even faster. In 17.4 we [&hellip;]<\/p>\n","protected":false},"author":101518,"featured_media":31319,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,3927,218],"tags":[],"class_list":["post-31318","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus","category-game-development","category-performance"],"acf":[],"blog_post_summary":"<p>Building on top of our performance wins in Visual Studio 2022 version 17.3, we are excited to announce additional improvements in version 17.4. Whether you are a game developer, work with large codebases, or have solutions with many C++ projects, your development experience in Visual Studio 2022 17.4 will feel even faster. In 17.4 we [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/31318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/101518"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=31318"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/31318\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/31319"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=31318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=31318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=31318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}