microsoft / microsoft/vscode-cpptools

cpptools takes hours of CPU time per day for a project which compiles in 5 seconds

Aperta
#5,574 64 commenti 58 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

investigate: repro Language Service not reproing performance
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

Type: LanguageService

Describe the bug

  • OS and Version: OSX 10.15.4
  • VS Code Version: 1.45.1
  • C/C++ Extension Version: 0.28.1

For every C++ project, even tiny ones which compile in a few seconds, a cpptools process runs for something between 6 and 40 minutes every time I open the project and also from time to time after editing or git operations. Over the day this accumulates to many hours and estimated about 25% of the time my laptop fan runs cause of cpptools (it hardly every runs cause of compiles). Also the memory consumption of cpptools is fairly high - around 7GB is common. I guess this has to do with scanning system headers, but is still seems wasteful to spend 30 minutes on symbol analysis for a project where a release build takes 5 seconds. This is not really a bug, but to me it looks like unnecessary waste of resources.

One more observation: when I delete the folder in which VSCode keeps the database (on Mac ~/Library/Application Support/VSCodium/User/workspaceStorage/) it runs the first time "only" for 6 minutes - Intellisense is fully operational. The second time it decides to run for the same projects - about 1 hour later - it runs for 29 minutes.

Steps to reproduce

  • Open any project with C files
  • Look at the CPU time of the cpptools process

Expected behavior

  • cpptools needs less than 10x the compile time

In case you cannot reproduce this (for me this happens for every C++ project every time since at least 6 months) I can of cause provide logs, a sample project and gprof statistics.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il problema con un piccolo progetto C/C++ e analizza l’utilizzo della CPU e della memoria da parte di cpptools, incluso il comportamento del database del workspace descritto per macOS. Esamina i log disponibili, il progetto di esempio e le statistiche gprof fornite dal segnalatore; il lavoro è completo quando l’utilizzo delle risorse è ridotto fino ad avvicinarsi all’aspettativa indicata di meno di 10 volte il tempo di compilazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, vscode
Ambito
devtools, performance
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.