microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.53k stars 1.56k forks source link

Multi-threaded parsing #1250

Open devlay opened 6 years ago

devlay commented 6 years ago

Would it be possible to add a setting that allows the user to specify number of cores to use for parsing?

sean-mcmanus commented 6 years ago

Yes, assuming you're referring to the symbol parser (database icon) and not the intellisense parser (flame), but we would need to modify the implementation to make the work easier to spread across threads. Our current goal is to first improve the efficiency of the implementation using 1-2 threads. If you open files, the parsing of that file and its dependencies is already occurring on a separate thread from the non-open files on the "background" thread and intellisense parsing occurs on another thread.

rogercloud commented 3 years ago

What's the state of this feature? It really takes a looong time to parse the files in the Linux kernel. This feature is helpful in large projects.

sean-mcmanus commented 3 years ago

@rogercloud Are you referring to the "tag parser" (database icon, with C_Cpp.loggingLevel set to "Debug" it shoudl show "tag parsing" messages)? Usually that parsing should only need to occur one time to populate the database unless there's a change that causes it to reset. You can also add subfolders to C_Cpp.files.exclude to reduce the amount of parsing required.

This work item may not actually speed stuff up that much because the database writing may be a bottleneck...maybe 30% improvement and not > 2 times an improvement would be expected.

haileys commented 3 months ago

Hi, I'd just like to add my voice to the crowd having trouble with single-threaded cpptools parsing. I am experiencing frequent reindexes on a codebase with a large amount of code in submodules, and cpptools sits at 100% of an entire CPU core for minutes at a time - often 3 to 4 minutes - as it reindexes.

I have a 24 core machine and I believe multi-threaded parsing would make a significant improvement to index time.