I've been having all sorts of lag issues with vscode lately! Can anyone tell me why?
For example, in this screenshot, vscode is always loading something from git. I don't know what it is loading, but it has been very slow recently!
I thought it was a problem with my local git, but when I tried to commit using the git command, I found that there was no problem at all! When I pushed using the command, it was still loading!
I have disabled Git related plugins, leaving only Copliot!
- Version: 1.97.2 (system setup)
- Commit:e54c774e0add60467559eb0d1e229c6452cf8447Date:2025-02-12T23:20:35.343Z (2 wks ago)Electron: 32.2.7
- ElectronBuildld:10982180
- Chromium:128.0.6613.186
- Node.js: 20.18.1
- V8:12.8.374.38-electron.0
- OS: Windows NT x64 10.0.22631
same issue although i dont have the plugins mentioned in op
Are you able to reproduce with all 3rd party extensions disabled? Could you please check the contents of the git output window?
I tried to reproduce it today. Since there is no code file to be submitted, the information may not be exactly the same as in the screenshot, But I found a potentially useful piece of information and two very slow git logs:
Suspicious information: It first looks for Git from the C drive, but I installed it on the D drive, but apparently eventually it found the correct Git:
2025-03-05 10:53:34.618 [info] [main] Log level: Info
2025-03-05 10:53:34.618 [info] [main] Validating found git in: "C:\Program Files\Git\cmd\git.exe"
2025-03-05 10:53:34.618 [info] [main] Validating found git in: "C:\Program Files (x86)\Git\cmd\git.exe"
2025-03-05 10:53:34.618 [info] [main] Validating found git in: "C:\Program Files (x86)\Git\cmd\git.exe"
2025-03-05 10:53:34.618 [info] [main] Validating found git in: "C:\Program Files\Git\cmd\git.exe"
2025-03-05 10:53:34.618 [info] [main] Validating found git in: "C:\Users\ddd\AppData\Local\Programs\Git\cmd\git.exe"
2025-03-05 10:53:34.718 [info] [main] Validating found git in: "D:\Program Files\Git\cmd\git.exe"
2025-03-05 10:53:34.860 [info] [main] Using git "2.45.2.windows.1" from "D:\Program Files\Git\cmd\git.exe"
2025-03-05 10:53:34.860 [info] [Model][doInitialScan] Initial repository scan started
2025-03-05 10:53:34.861 [info] [Model][doInitialScan] Initial repository scan completed - repositories (0), closed repositories (0), parent repositories (0), unsafe repositories (0)
2025-03-05 10:53:40.908 [info] [main] Log level: Info
2025-03-05 10:53:40.908 [info] [main] Validating found git in: "C:\Program Files\Git\cmd\git.exe"
2025-03-05 10:53:40.908 [info] [main] Validating found git in: "C:\Program Files (x86)\Git\cmd\git.exe"
2025-03-05 10:53:40.908 [info] [main] Validating found git in: "C:\Program Files\Git\cmd\git.exe"
2025-03-05 10:53:40.908 [info] [main] Validating found git in: "C:\Users\ddd\AppData\Local\Programs\Git\cmd\git.exe"
2025-03-05 10:53:41.035 [info] [main] Validating found git in: "D:\Program Files\Git\cmd\git.exe"
2025-03-05 10:53:41.179 [info] [main] Using git "2.45.2.windows.1" from "D:\Program Files\Git\cmd\git.exe"
2025-03-05 10:53:41.179 [info] [Model][doInitialScan] Initial repository scan started
- The first slow execution record seems to be when the project is just opened,
git rev-parse --show-toplevelwill execute very slowly:
2025-03-05 10:54:10.025 [info] > git check-ignore -v -z --stdin [128ms]
2025-03-05 10:54:27.050 [info] > git rev-parse --show-toplevel [40382ms]
2025-03-05 10:54:27.051 [info] [Model][doInitialScan] Initial repository scan completed - repositories (1), closed repositories (0), parent repositories (0), unsafe repositories (0)
2025-03-05 10:54:27.547 [info] > git config --get commit.template [273ms]
- After I edit some files,
git ls-files --stageseems to run very slowly occasionally:
2025-03-05 10:59:41.182 [info] > git show --textconv :components/u/PostList.vue [196ms]
2025-03-05 11:00:21.364 [info] > git ls-files --stage -- E:\xxxx\components\u\PostList.vue [40376ms]
2025-03-05 11:00:21.546 [info] > git cat-file -s 2e1c44cb260587eb557d991b79ed43dd5115d437 [94ms]
Hope this helps. If the same problem as the screenshot occurs next time, I will try to check the
git logand provide it.
Supplement: This command(git for-each-ref --format=******) is also executed very slowly, and it is always very slow(have two slow within 5 minutes.):
2025-03-05 14:55:09.642 [info] > git show --textconv :Dockerfile [279ms]
2025-03-05 14:55:09.784 [info] > git cat-file -s 0abef4a659336525f3387338234c0d77a88bbb94 [142ms]
2025-03-05 14:55:46.124 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) --ignore-case refs/heads/main refs/remotes/main [40428ms]
2025-03-05 14:55:46.426 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [206ms]
2025-03-05 14:55:46.451 [info] > git status -z -uall [234ms]
2025-03-05 15:00:56.124 [info] > git config --get commit.template [216ms]
2025-03-05 15:00:56.138 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) --ignore-case refs/heads/main refs/remotes/main [227ms]
2025-03-05 15:00:56.429 [info] > git status -z -uall [230ms]
2025-03-05 15:00:56.509 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [171ms]
2025-03-05 15:01:07.748 [info] > git config --get commit.template [211ms]
2025-03-05 15:01:10.745 [info] > git add -A -- E:\Code\wechatbot\Dockerfile [140ms]
2025-03-05 15:01:11.034 [info] > git config --get commit.template [228ms]
2025-03-05 15:01:11.131 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) --ignore-case refs/heads/main refs/remotes/main [184ms]
2025-03-05 15:01:11.463 [info] > git status -z -uall [244ms]
2025-03-05 15:01:11.630 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [304ms]
2025-03-05 15:01:11.721 [info] > git show --textconv HEAD:Dockerfile [259ms]
2025-03-05 15:01:11.805 [info] > git ls-tree -l HEAD -- E:\Code\wechatbot\Dockerfile [176ms]
2025-03-05 15:01:12.386 [info] > git ls-files --stage -- E:\Code\wechatbot\Dockerfile [236ms]
2025-03-05 15:01:12.506 [info] > git ls-tree -l HEAD -- E:\Code\wechatbot\Dockerfile [234ms]
2025-03-05 15:01:12.727 [info] > git cat-file -s 48d062e2b1c4a034eaa3cffc41708a4369cf5fb1 [221ms]
2025-03-05 15:01:12.846 [info] > git show --textconv HEAD:Dockerfile [218ms]
2025-03-05 15:01:12.930 [info] > git show --textconv :Dockerfile [84ms]
2025-03-05 15:01:48.120 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) --ignore-case refs/heads/main refs/remotes/main [40449ms]
I had almost the same problem today, and this time I found another command (git status -z -uall) that was executing very slowly:
2025-03-06 20:09:06.458 [info] > git config --get commit.template [162ms]
2025-03-06 20:09:06.509 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) --ignore-case refs/heads/main refs/remotes/main [150ms]
2025-03-06 20:09:47.601 [info] > git status -z -uall [41041ms]
2025-03-06 20:09:47.605 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [299ms]
emmmm…… new slow log(git config --get commit.template):
2025-03-07 11:03:03.592 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) --ignore-case refs/heads/main refs/remotes/main [411ms]
2025-03-07 11:03:03.593 [info] > git config --get commit.template [40987ms]
2025-03-07 11:03:03.771 [info] > git status -z -uall [130ms]
I have absolutely no idea what's going on...
Thanks you for the logs. The logs indicate that running various git.exe commands on the machine are slow hence VS Code appears to be slow. I would suggest that you investigate why running git.exe commands are slow. Things that I suggest that you try: 1) upgrade git, 2) perform maintenance on the git repository.
Well, since this is not a vscode problem, let's close it.
However, I upgraded git and it still didn't work. I don't know if it's caused by too many local repositories. Hope I can find the reason!😤