Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2017: Speed up C++ IntelliSense

I use a header only library in my C++ project.

When I make a change in my code, Visual Studio starts parsing files in my solution, including the included library.

Since the library is big, parsing it is slow and I have to wait for a long time until IntelliSense becomes relevant again.

Is there a way to speed up this parsing, perhaps, by excluding the library from IntelliSense?

This question is NOT a duplicate of Visual Studio 2017 is too slow during building and debugging because it deals specifically with speeding up IntelliSense, which is not touched by the other question, nor it's answers.

like image 376
Draex_ Avatar asked Mar 20 '18 10:03

Draex_


3 Answers

This seemingly unrelated issue fixed slow IntelliSense for me: https://stackoverflow.com/a/55401328/6800366

  • Go to Options > Environment > General
  • Uncheck "Automatically adjust visual experience based on client performance"
  • Uncheck "Use hardware graphics acceleration if available"

Maybe unchecking "Enable rich client visual experience" also helps for you. It made no difference for me.

like image 162
Kevin van der Pol Avatar answered Oct 23 '22 22:10

Kevin van der Pol


You can increase Rescan Solution interval in the VS settings. Goto Options -> Text Editor -> C/C++ -> Advanced and set Rescan Solution interval to desired minutes. I prefer 5000. The value must be between 0 and 5000.

Changes you make are parsed in real time (ie: as you make them), however every set amount of time a complete parse is triggered to ensure that the whole database is up to date. This extra parse won’t actually clean up your database and recreate it from scratch but rather scan for changes made on files that are not active (take for example opening one of the header files your project is referencing on a different instance of Visual Studio). By default this is every 60 minutes, by changing this you can control that interval.

like image 35
273K Avatar answered Oct 23 '22 22:10

273K


1) Visual settings, 2) re-scan interval and 3) deletion of project cache made limited (if any for 1,2) effects in my case.


Then I start playing with Automatic Precompiled Header Cache Quota (Tools > Options > Text Editor > C/C++ > Advanced). In first step I've increased it from default 50Gb to 75gb - guess what: it became slower and slower. Once cache directory ([solution directory].vs) reached the limit - IntelliSense became completely useless.

If you think: really, how 50gb-75gb of precompiled code could lead to faster IntelliSense? Such amount of data has to be indexed, queried... maintained. Setting limit to 10Gb made my day. IntelliSense became responsive as it should be.


I have to point out that issue is not limited to VS2017, but also occurs in VS2019. This issue actually made me trying VS2019. While VS2019 is really much better with C++ than VS2017, it has the same problem with project cache. Also, it is important to say that this is not only VS C++ issue, I had same/similar problem with project cache [.vs] back in my C# years. It is just more drastic with C++ projects due language specifics.

like image 1
hardyVeles Avatar answered Oct 23 '22 22:10

hardyVeles