microsoft / microsoft/vscode-cpptools
Tag parser is very slow on a C++ file with an include that contains a symbolic link
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
Descrizione
Environment
- OS and Version: Windows, 10
- VS Code Version: 1.74.0
- C/C++ Extension Version: 1.13.6
- Other extensions you installed (and if the issue persists after disabling them): CMake, CMake Tools, Doxygen Documentation Generator, Perforce for VS Code
- If using SSH remote, specify OS of remote machine: Using SSH remote, connecting to RHEL Linux 7.6
- A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).: Our workspace seems to get parsed fine until it hits a Qt MOC'ed file. This generates a file with a
#includethat looks something like:#include "../../../../../src/my_dir/my_cpp_file.h". In this case,../../../../../srcis a symbolic link pointing to/home/AUser/dev/src. When I replace the../../../../../srcwith/home/AUser/dev/src, the tag parser blazes through the file and doesn't get stuck.
After waiting for about 5 minutes, it finally proceeded to finish parsing the file, which is only about 100 lines.
Bug Summary and Steps to Reproduce
Bug Summary:
The tag-parser seems to seriously degrade in performance on an include that has a symbolic link in the path. For example, Qt's moc produces moc_<source_Name>.cpp files where the first #include looks something like #include "../../../../../src/my_dir/my_cpp_file.h". In this case, ../../../../../src is a symbolic link to /home/AUser/dev/src.
When I replace the ../../../../../src with /home/AUser/dev/src the tag parser takes less than 1 second. With the symbolic link, it takes about 5 minutes to tag-parse the file.
I tried to replicate this with a small, reproducable project, but I was unable to. The project is somewhat large that I am working on (~11000 files). Essentially, Qt's MOC executable produces a moc source file that has the following includes:
#include <memory>
#include "../../../../../src/my_dir/myFile.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file myFile.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.15.10. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
As explained above, the src in the path is a symbolic link and the tag parser seems to fail on that include. Like I said before, if I manually modify that include to use the real path to the file, the tag parser continues.
Expected behavior
Include paths with symbolic links shouldn't degrade performance that bad.
Code sample and Logs
As this is a company project, I cannot post the output from the Log, as it contains many paths to our private source code.
Screenshots
No response
Additional context
No response
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il rallentamento con un file moc C++ generato da Qt il cui percorso di inclusione contiene un collegamento simbolico, confrontandolo con il percorso reale equivalente. Esamina la gestione di quell’inclusione da parte del parser dei tag e usa la differenza di tempo riportata come verifica del completamento.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- performance, tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100