vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

.vscode caching too much data since update

Open ghost opened this issue 7 years ago • 53 comments

I have noticed since the recent update that cpptools seems to be caching a lot of data (~1GB for a small project). This seems to be in an ".vscode/ipch" subdirectory.

download_20190323_132636

ghost avatar Mar 23 '19 02:03 ghost

That is "by design". You can reduce the size used by changing the intelliSenseCacheSize setting for either the current workspace or all workspace (i.e. the user setting).

sean-mcmanus avatar Mar 23 '19 03:03 sean-mcmanus

Was this feature implemented in the most recent update? I feel that this could be a bit dangerous as the vscode directory is hidden. It is a significant amount of data to be generated on a per-project basis for a lightweight editor.

Just an opinion though, I appreciate the quick response.

ghost avatar Mar 23 '19 04:03 ghost

I think the choice of the .vscode folder might have been the wrong folder for this. I know the community is about 50/50 on if you should commit the .vscode folder to source control, and this is causing havoc in our source control setups. Why was the per workspace folders provided by vscode not used? And is there any way in the settings to change to that, as I would much prefer my store location to be there.

ThadHouse avatar Mar 25 '19 00:03 ThadHouse

I know the community is about 50/50 on if you should commit the .vscode folder to source control

I'm one of those who commit .vscode ;)

Also, I think it would be better to have single cache for whole extension. I'm switching between 10+ large projects and ipch files are more and more consuming my disk space. It could be configurable to save it separately for a given project if one wants to have it that way (e.g. prevent deleting because of other projects hitting global cache size limit in the meantime), but having those files in every project is a) confusing, b) unreasonable for small disks.

tehKaiN avatar Mar 25 '19 12:03 tehKaiN

@ThadHouse the VS Code per-workspace folders were not selected for the following reasons:

  • Parity with Visual Studio. This is how Visual Studio works and they receive little to no feedback/complaints on the location.
  • The workspace storage location provided by VS Code is somewhat obscure and we had reservations about writing GB's worth of files in this location where users may not see them or know where to find them.

With this in mind we knew that we wouldn't be able to please everyone, so we provided settings to allow you to customize this the way that works best for you. We also figured that putting the files in the workspace folder would bring the issue to your attention quickly so that you can take action if you don't like the default behavior.

"C_Cpp.intelliSenseCachePath": <string>

This setting allows you to set workspace or global overrides for the cache path. @tehKaiN, if you want a single cache for the whole extension, you just open the VS Code settings, and add a "User" setting for "IntelliSense Cache Path".

"C_Cpp.intelliSenseCacheSize": <number>

This setting allows you to set a limit on the amount of caching the extension does. If you want to use a global cache and increase/decrease the limit, that's fine. This is an approximation, but the extension will make a best effort to keep the cache size as close to the limit you set as possible.

bobbrow avatar Mar 25 '19 16:03 bobbrow

Another thing we can potentially take away from this discussion is that perhaps the extension can prompt users to select a default behavior for caching before it begins doing it. The toast messages can be ineffective since people will just click something or press Esc to make them go away, but it might address some of the concerns raised here.

bobbrow avatar Mar 25 '19 16:03 bobbrow

Yep, this .vscode/ipch folder is a real pain.

crazyBaboon avatar Mar 26 '19 22:03 crazyBaboon

@crazyBaboon, can you clarify why is it a pain for you? Are you able to use the settings to control the feature the way you want?

bobbrow avatar Mar 27 '19 02:03 bobbrow

Why is this a pain in any case? Is there a problem if I just .gitignore it?

Rob

MemoryChips avatar Mar 28 '19 15:03 MemoryChips

There is no problem if you .gitignore it. That's what we expect most people to do, but in cases where you want customized behavior, we have provided additional settings which we hope will get you the behavior you want. If this is insufficient, we'd like to understand how we can make it better.

bobbrow avatar Mar 28 '19 15:03 bobbrow

The java extension actually checks that it's plugin used files are in the vscode settings files.exclude list. It might do that with .gitignore too. Maybe that's something to look at doing. Check if that folder is properly ignored, and if not prompt the user to add it.

ThadHouse avatar Mar 28 '19 18:03 ThadHouse

Git is not the only reason why it would be unacceptable to be able to use up to 5GB so liberally. It is not reasonable to assume a "lightweight editor" is going to produce a 1.3 GB precompiled header in a hidden folder just by opening an existing C++ project directory to do a quick edit on a file.

I understand that you have provided options to dial this down but I had to notice that 1/3 of my Google drive space had suddenly disappeared before investigating what was going on. I also have a laptop with a 256 GB SSD, the default 5GB setting is 2% of my total capacity.

Ultimately the thing that bothers me the most about it is that I use vscode because full blown VS is a bloated mammoth. I don't like that every VS project contained hidden folders with hundreds of megabytes of data for a single hello-world source file. This recent update now puts vscode in the same boat and is pushing vscode out of the powerful lightweight editor and more into the full blown IDE spectrum.

This seems excessive just for an intellisense improvement. Is there no other way? Was intellisense really that bad a couple of weeks ago?

I really hope this doesn't come across as being rude, I am just very passionate about vscode. I probably spend most of my day, every single day using it for work and hobbies. The work you guys are doing is amazing, but this has made me a little fearful that vscode may eventually end up half as bloated as it's big brother.

ghost avatar Mar 28 '19 18:03 ghost

@unl1ght, I appreciate the candid feedback. If you haven't been experiencing any performance problems with previous versions of the extension, then that's great to hear. If you don't feel you need the caching, you can turn it off with the intelliSenseCacheSize setting (set it to 0).

We've been receiving a lot of feedback in our survey about performance problems with the extension. Aligning with VS in this respect is an attempt to address these reports. We continue to investigate other ways to improve performance too.

bobbrow avatar Mar 29 '19 00:03 bobbrow

Would it be possible to have the .vscode/ipch directory automatically added to .git/info/exclude when cloning a repository?

Rationale:

  • Probably noone is willing to track and and commit them.
  • .gitignore is IMO not the right place, as these are vscode artifacts (and not everyone is using it).
  • I often clone repos to look at code I'm not allowed (or willing) to commit to, and having a number of untracked files showing up is mildly annoying.
  • Since I have quite sane user defaults for this kind of projects, those are, in fact, the only things created in the .vscode directory.

Of course, doing it manually is not a big deal...

newbrain avatar Mar 29 '19 09:03 newbrain

We had the same sort of complaints when we originally placed our .browse.vc.db file in the .vscode folder (databaseFilename setting). We're considering changing the default intelliSesneCachePath setting to the workspace storage location (where our symbol database defaults to -- the "con" being it's harder to locate delete there) or the temp directory (where our pipe files are generated, the "con" being it might get deleted unintentionally).

sean-mcmanus avatar Mar 29 '19 18:03 sean-mcmanus

I work in a very resource limited embedded system and usually I edit the code directly on the little device by mounting it with my desktop over sshfs. Before the update everything was fine but now the local ipch folder frequently grows large enough to consume the whole memory of my embedded system (~100 MB) and setting the "C_Cpp.intelliSenseCachePath" doesn't seem to default to the user setting when the workspace is recreated (which is frequently). I just wanted to point out a specific reason not to default the cache in the local working directory. After a while of deleting the ipch directory frequently I finally came here to figure out what the heck that directory was.

kckemper avatar Mar 29 '19 23:03 kckemper

@kckemper intelliSenseCachePath as a user setting is supposed to work, unless it uses an environment variable (it's a bug fix that we haven't shipped yet). Can you provide more info about that path you are using?

sean-mcmanus avatar Mar 29 '19 23:03 sean-mcmanus

"C_Cpp: Intelli Sense Cache Path" is "~/.vscode"

kckemper avatar Mar 30 '19 00:03 kckemper

@kckemper Yes, that is the bug we fixed (https://github.com/Microsoft/vscode-cpptools/pull/3368 ). We plan to ship a fix for that next week.

sean-mcmanus avatar Mar 30 '19 00:03 sean-mcmanus

@crazyBaboon, can you clarify why is it a pain for you? Are you able to use the settings to control the feature the way you want?

It should do the cache outside the git folder IMO, like in the .config or something like that.

crazyBaboon avatar Mar 31 '19 16:03 crazyBaboon