Repository: vscode
Issue: Git - extremely slow even though running the same commands manually is very fast
Labels: bug,git,perf

Type: <b>Bug</b>

Any action in Git takes ages (minutes). The Git output window shows that each command which VSCode executes takes 3-20 seconds (!). However, if I manually copy those commands into the console, they execute almost instantly, so it's unclear where all that time gets wasted.

I'm on Remote WSL1.

Here is an excerpt from the log:

```
2023-01-11 00:45:47.260 [info] > git config --get commit.template [21372ms]
2023-01-11 00:45:50.374 [info] > git cat-file -s ec66a5ca6862f6404423cad5184bc7e8efece6d2 [6145ms]
2023-01-11 00:45:50.375 [info] > git cat-file -s c15071bbe817bf8cb54447a374d215ed6eff8356 [9197ms]
2023-01-11 00:45:50.375 [info] > git ls-files --stage -- /mnt/c/Users/david/proj/***/providers/***.js [12280ms]
2023-01-11 00:46:02.771 [info] > git show --textconv :app/Controllers/Http/UserApiController.js [3140ms]
2023-01-11 00:46:02.772 [info] > git ls-files --stage -- /mnt/c/Users/david/proj/***/app/Models/***.js [12399ms]
2023-01-11 00:46:05.906 [info] > git cat-file -s 266be854aff5cfef7db907825d9072c68d44f57b [18646ms]
2023-01-11 00:46:05.915 [info] > git show --textconv :app/Controllers/Http/MainController.js [3146ms]
2023-01-11 00:46:05.918 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/fix refs/remotes/fix [9394ms]
2023-01-11 00:46:11.961 [info] > git cat-file -s afc1ef2584ad53e301b38acf58efc92935fe39b7 [18454ms]
2023-01-11 00:46:14.993 [info] > git status -z -uall [6058ms]
2023-01-11 00:46:14.995 [info] > git cat-file -s 8ebecd9ed5aabcdd2c4e99953cfc67c55d64e98f [9090ms]
2023-01-11 00:46:18.038 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [6073ms]
2023-01-11 00:46:21.318 [info] > git show --textconv :app/Lib/***/index.js [6326ms]
2023-01-11 00:46:21.318 [info] > git show --textconv :providers/***.js [3286ms]
2023-01-11 00:46:21.331 [info] > git show --textconv :app/Models/***.js [15ms]
2023-01-11 00:52:38.010 [info] > git add -A -- /mnt/c/Users/david/proj/***/providers/***.js [16ms]
2023-01-11 00:52:41.215 [info] > git config --get commit.template [10ms]
2023-01-11 00:52:44.336 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/fix refs/remotes/fix [12ms]
2023-01-11 00:53:04.795 [info] > git status -z -uall [17511ms]
2023-01-11 00:53:07.817 [info] > git ls-files --stage -- /mnt/c/Users/david/proj/***/providers/***.js [3027ms]
2023-01-11 00:53:11.251 [info] > git ls-files --stage -- /mnt/c/Users/david/proj/***/app/Controllers/Http/MainController.js [9540ms]
2023-01-11 00:53:14.289 [info] > git ls-files --stage -- /mnt/c/Users/david/proj/***/app/Controllers/Http/UserApiController.js [15471ms]
2023-01-11 00:53:17.181 [info] > git ls-files --stage -- /mnt/c/Users/david/proj/***/app/Lib/***/index.js [21258ms]
2023-01-11 00:53:20.076 [info] > git ls-files --stage -- /mnt/c/Users/david/proj/***/app/Models/***.js [26988ms]
2023-01-11 00:53:23.031 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [32787ms]
2023-01-11 00:53:23.045 [info] > git cat-file -s 266be854aff5cfef7db907825d9072c68d44f57b [2970ms]
2023-01-11 00:53:23.046 [info] > git cat-file -s ec66a5ca6862f6404423cad5184bc7e8efece6d2 [5866ms]
2023-01-11 00:53:23.046 [info] > git cat-file -s c15071bbe817bf8cb54447a374d215ed6eff8356 [8760ms]
2023-01-11 00:53:23.047 [info] > git cat-file -s e33676f2c6486c28944c0876103198ac763c6952 [11797ms]
2023-01-11 00:53:23.048 [info] > git cat-file -s 8ebecd9ed5aabcdd2c4e99953cfc67c55d64e98f [18ms]
2023-01-11 00:53:23.063 [info] > git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file - [15250ms]
```

VS Code version: Code 1.74.3 (97dec172d3256f8ca4bfb2143f3f76b503ca0534, 2023-01-09T16:59:02.252Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Sandboxed: No
Remote OS version: Linux x64 4.4.0-19041-Microsoft

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|AMD Ryzen 7 PRO 4750U with Radeon Graphics (16 x 1697)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_renderer: enabled_on<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: disabled_off|
|Load (avg)|undefined|
|Memory (System)|31.23GB (4.81GB free)|
|Process Argv||
|Screen Reader|no|
|VM|0%|

|Item|Value|
|---|---|
|Remote|WSL: Ubuntu-20.04|
|OS|Linux x64 4.4.0-19041-Microsoft|
|CPUs|AMD Ryzen 7 PRO 4750U with Radeon Graphics (16 x 1700)|
|Memory (System)|31.23GB (4.81GB free)|
|VM|0%|
</details><details><summary>Extensions (65)</summary>

Extension|Author (truncated)|Version
---|---|---
auto-close-tag|for|0.5.14
vscode-graphql-syntax|Gra|1.0.5
dotenv|mik|1.0.1
vscode-aql|mon|1.7.0
jupyter-keymap|ms-|1.0.0
remote-containers|ms-|0.266.1
remote-ssh|ms-|0.94.0
remote-ssh-edit|ms-|0.84.0
remote-wsl|ms-|0.72.0
remote-explorer|ms-|0.0.3
ejs-language-support|Qas|0.0.1
vscode-todo-highlight|way|1.0.5
vscode-devdocs|akf|1.0.3
svelte-intellisense|ard|0.7.1
vscode-intelephense-client|bme|1.9.3
npm-intellisense|chr|1.4.4
js-codeformer|cms|2.6.1
compulim-vscode-closetag|Com|1.2.0
vscode-eslint|dba|2.2.6
devdocs|dei|0.2.0
vscode-new-file|dku|4.0.2
dbux-code|Dom|0.7.9
xml|Dot|2.5.1
EditorConfig|Edi|0.16.4
copilot|Git|1.65.7705
vscode-graphql-execution|Gra|0.1.6
vscode-graphql-syntax|Gra|1.0.5
vscode-git-blamer|how|1.1.2
join-comment-aware|joh|0.0.3
solidity|Jua|0.0.141
edge|luo|0.3.2
rainbow-csv|mec|3.5.0
csharp|ms-|1.25.2
vscode-dotnet-runtime|ms-|1.6.0
isort|ms-|2022.8.0
python|ms-|2022.20.1
vscode-pylance|ms-|2023.1.10
jupyter|ms-|2022.11.1003412109
jupyter-keymap|ms-|1.0.0
jupyter-renderers|ms-|1.0.12
vscode-jupyter-cell-tags|ms-|0.1.6
vscode-jupyter-slideshow|ms-|0.1.5
cpptools|ms-|1.13.9
hexeditor|ms-|1.9.9
hexeditor|not|1.8.2
vscode-print|pdc|0.10.20
svelte-extractor|pro|0.0.3
vscode-data-preview|Ran|2.3.0
vscode-data-table|Ran|1.12.0
vscode-yaml|red|1.11.0
ActiveFileInStatusBar|Ros|1.0.3
vscode-paste-and-indent|Rub|0.0.8
bracket-jumper|sas|1.1.8
trailing-spaces|sha|0.4.1
vscode-standard|sta|2.1.3
runme|sta|0.4.2
vscode-stripe|str|2.0.14
ignore-gitignore|stu|1.0.1
svelte-vscode|sve|107.0.1
es6-string-html|Tob|2.12.0
sort-***s|Tyr|1.9.1
use-strict-everywhere|vee|0.1.3
bracket-padder|via|0.3.0
change-case|wma|1.0.0
html-css-class-completion|Zig|1.20.0


</details>
<!-- generated by issue reporter -->