Repository: vscode
Issue: File explorer performance degrades when the number of files in workspaces is large
Labels: bug,file-explorer,performance

Type: <b>Performance Issue</b>

I ran into the issue where switching to file explorer view from any other view pretty much takes 5-10 seconds.
![image](https://github.com/microsoft/vscode/assets/3840081/7680ed89-8cb2-4b7f-9c76-c3e9271ada4d)


OS: Windows
Requirements:
* python 3.8 or greater
* Cargo tools (rustup) latest stable
* Dotnet SDK net6.0 

Steps to repro:
1. Clone this repo: https://github.com/microsoft/lsprotocol
2. Create a virtual environment using pyhton 3.8 or greater: `python -m venv .venv`
3. Activate virtual environment and install requirements.txt
4. Install nox task runner: `python -m pip install nox`
5. Run this command to genenrate all the files in the repo: `nox --session build_lsp`

Once code is generated try navigating to `packages/dotnet` or `packages/testdata` 

VS Code version: Code - Insiders 1.85.0-insider (345c8d0927402d41f42402411d856eeec4013e5e, 2023-11-13T05:39:23.476Z)
OS version: Windows_NT x64 10.0.19045
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz (8 x 1498)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<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>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled|
|Load (avg)|undefined|
|Memory (System)|31.60GB (17.08GB free)|
|Process Argv|--log info --log ms-python.python:info --log github.vscode-pull-request-github:info --crash-reporter-id 4fb1ebc1-cf4c-4880-a88a-47738ec3768d|
|Screen Reader|no|
|VM|0%|
</details><details>
<summary>Process Info</summary>

```
CPU %	Mem MB	   PID	Process
    0	   182	 11284	code-insiders main
    0	    85	  3148	fileWatcher [1]
    0	   180	  5408	   gpu-process
    0	   298	  9840	extensionHost [1]
    0	   139	  4964	     electron-nodejs ("C:\Users\kanadig\AppData\Local\Programs\Microsoft VS Code Insiders\Code - Insiders.exe" --ms-enable-electron-run-as-node c:\Users\kanadig\.vscode-insiders\extensions\ms-python.vscode-pylance-2023.11.12\dist\server.bundle.js --cancellationReceive=file:c3dde821b365969644611bf8af714874eab5f23c2c --node-ipc --clientProcessId=9840)
    0	    82	  6564	     electron-nodejs ("C:\Users\kanadig\AppData\Local\Programs\Microsoft VS Code Insiders\Code - Insiders.exe" --ms-enable-electron-run-as-node "c:\Users\kanadig\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\json-language-features\server\dist\node\jsonServerMain" --node-ipc --clientProcessId=9840)
    0	    99	  7200	     electron-nodejs ("C:\Users\kanadig\AppData\Local\Programs\Microsoft VS Code Insiders\Code - Insiders.exe" --ms-enable-electron-run-as-node c:\Users\kanadig\.vscode-insiders\extensions\github.vscode-github-actions-0.26.2\dist\server-node.js --node-ipc --clientProcessId=9840)
    0	     8	  7496	     c:\GIT\LSP\lsprotocol\.venv\Scripts\python.exe c:\Users\kanadig\.vscode-insiders\extensions\ms-python.black-formatter-2023.7.13171007\bundled\tool\lsp_server.py
    0	    59	 18632	       C:\Users\kanadig\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe c:\Users\kanadig\.vscode-insiders\extensions\ms-python.black-formatter-2023.7.13171007\bundled\tool\lsp_server.py
    0	    11	 19228	       C:\Windows\system32\conhost.exe 0x4
    0	     8	 18468	     c:\GIT\LSP\lsprotocol\.venv\Scripts\python.exe c:\Users\kanadig\.vscode-insiders\extensions\charliermarsh.ruff-2023.50.0-win32-x64\bundled\tool\server.py
    0	    11	  5648	       C:\Windows\system32\conhost.exe 0x4
    0	    52	  9552	       C:\Users\kanadig\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe c:\Users\kanadig\.vscode-insiders\extensions\charliermarsh.ruff-2023.50.0-win32-x64\bundled\tool\server.py
    0	     8	 19768	     c:\GIT\LSP\lsprotocol\.venv\Scripts\python.exe c:\Users\kanadig\.vscode-insiders\extensions\ms-python.isort-2023.11.13101013\bundled\tool\lsp_server.py
    0	    54	 14724	       C:\Users\kanadig\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe c:\Users\kanadig\.vscode-insiders\extensions\ms-python.isort-2023.11.13101013\bundled\tool\lsp_server.py
    0	    11	 15780	       C:\Windows\system32\conhost.exe 0x4
    0	   100	 19836	     electron-nodejs ("C:\Users\kanadig\AppData\Local\Programs\Microsoft VS Code Insiders\Code - Insiders.exe" --ms-enable-electron-run-as-node c:\Users\kanadig\.vscode-insiders\extensions\streetsidesoftware.code-spell-checker-3.0.1\packages\_server\dist\main.cjs --node-ipc --clientProcessId=9840)
    0	   574	 12052	window [1] (lsprotocol - Visual Studio Code - Insiders)
    0	    29	 17892	   crashpad-handler
    0	    41	 18404	   utility-network-service
    0	   172	 18416	shared-process
    0	    97	 18452	window [2] (Issue Reporter)
    0	    84	 20460	ptyHost
    0	     5	  4500	     C:\Windows\System32\cmd.exe
    0	     7	 17796	     conpty-agent
```

</details>
<details>
<summary>Workspace Info</summary>

```
|  Window (lsprotocol - Visual Studio Code - Insiders)
|    Folder (lsprotocol): more than 20538 files
|      File types: py(8688) pyc(5359) json(730) pyi(639) pyd(261) exe(224)
|                  txt(220) typed(115) test(70) file(42)
|      Conf files: github-actions(7) makefile(2) devcontainer.json(1)
|                  dockerfile(1) sln(1)
|      Launch Configs: python(2);
```

</details>
<details><summary>Extensions (29)</summary>

Extension|Author (truncated)|Version
---|---|---
tsl-problem-matcher|amo|0.6.2
ruff|cha|2023.50.0
vscode-eslint|dba|2.4.2
gitlens|eam|14.4.1
EditorConfig|Edi|0.16.4
prettier-vscode|esb|10.1.0
copilot|Git|1.135.545
copilot-chat|Git|0.11.2023111302
remotehub|Git|0.62.0
vscode-github-actions|git|0.26.2
vscode-pull-request-github|Git|0.77.2023111309
vscode-docker|ms-|1.28.0
black-formatter|ms-|2023.7.13171007
isort|ms-|2023.11.13101013
python|ms-|2023.21.13141007
vscode-pylance|ms-|2023.11.12
remote-containers|ms-|0.321.0
remote-ssh|ms-|0.107.0
remote-ssh-edit|ms-|0.86.0
remote-wsl|ms-|0.81.8
vscode-remote-extensionpack|ms-|0.24.0
azure-account|ms-|0.11.6
azure-repos|ms-|0.38.0
remote-explorer|ms-|0.4.1
remote-repositories|ms-|0.40.0
remote-server|ms-|1.5.0
rust-analyzer|rus|0.4.1729
code-spell-checker|str|3.0.1
vscode-lldb|vad|1.10.0


</details><details>
<summary>A/B Experiments</summary>

```
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627cf:30244335
vslsvsres303:30308271
pythontb:30258533
vsc_aacf:30263846
pythonptprofiler:30281269
vsdfh931:30280409
vshan820:30294714
vscod805cf:30301675
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30404738
py29gd2263:30784851
vsclangdf:30492506
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30618038
vscrpc:30624061
a9j8j154:30646983
showlangstatbar:30737417
pythonfmttext:30716741
fixshowwlkth:30771523
showindicator:30805243
pythongtdpath:30726887
i26e3531:30792625
welcomedialog:30812478
pythonnosmt12:30779711
pythonidxpt:30768918
pythonnoceb:30776497
synctok:30869157
dsvsc013:30777762
dsvsc014:30777825
pythonmpsinfo:30859869
dsvsc015:30821418
pythontestfixt:30866404
pythonregdiag2:30871582
pyreplss1:30879911
pythonmypyd1:30859725
pythoncet0:30859736
pythontbext0:30879054
accentitlementst:30870582
dsvsc016:30879898
dsvsc017:30880771
dsvsc018:30880772
aa_t_chat:30882232

```

</details>

<!-- generated by issue reporter -->