Repository: vscode
Issue: Git - View file diff sometimes takes 5 seconds longer than expect
Labels: bug,git,perf

Type: <b>Performance Issue</b>

Viewing the changes of a file by clicking on it in the _Source Control_ panel sometimes takes (exactly) 5000ms seconds longer than usual.
Basically all files are affected by this. Sometimes they open within 100ms, sometimes it takes >5000ms. The _git_ output only says that the `git show --textconv HEAD:<file>` command takes >5000ms.

It happens without any extensions enabled in both stable (1.78.2) and insider (1.79.0) VSCode.

Here is a video and the related CPU profile (renamed to .txt for uploading...) that captures several slow and fast diffs:

https://github.com/microsoft/vscode/assets/128458361/edbe175f-a12d-45ae-ba33-8e12adeafdcb

[slow_diff.cpuprofile.txt](https://github.com/microsoft/vscode/files/11652360/slow_diff.cpuprofile.txt)

-----

VS Code version: Code - Insiders 1.79.0-insider (506cd5056d875ccdbea2e9a41ba7b9f19103d599, 2023-06-02T20:37:18.279Z)
OS version: Windows_NT x64 10.0.22621
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|13th Gen Intel(R) Core(TM) i7-1365U (12 x 2688)|
|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>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 (10.47GB free)|
|Process Argv|--crash-reporter-id 86592c2d-8d42-44e2-b58e-c89b6371bb2e|
|Screen Reader|no|
|VM|0%|
</details><details>
<summary>Process Info</summary>

```
CPU %	Mem MB	   PID	Process
    0	   100	 31168	code-insiders main
    0	   131	 10440	shared-process
    0	    84	 13676	fileWatcher [1]
    0	    88	 18872	window [2] (Issue Reporter)
    0	   129	 20184	extensionHost [1]
    0	    78	  1972	     electron-nodejs ("C:\Users\lukas\AppData\Local\Programs\Microsoft VS Code Insiders\Code - Insiders.exe" --ms-enable-electron-run-as-node "c:\Users\lukas\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\json-language-features\server\dist\node\jsonServerMain" --node-ipc --clientProcessId=20184)
    0	   244	 20956	window [1] (reading-time - Visual Studio Code - Insiders)
    0	   172	 21092	   gpu-process
    0	    82	 25028	ptyHost
    0	    30	 29808	   crashpad-handler
    0	    44	 30864	   utility-network-service
```

</details>
<details>
<summary>Workspace Info</summary>

```
|  Window (reading-time - Visual Studio Code - Insiders)
|    Folder (reading-time): 26 files
|      File types: ts(6) json(4) yml(2) editorconfig(1) eslintignore(1)
|                  eslintrc(1) gitattributes(1) gitignore(1) jshintrc(1)
|                  npmignore(1)
|      Conf files: github-actions(1) package.json(1) tsconfig.json(1);
```

</details>
Extensions: none<details>
<summary>A/B Experiments</summary>

```
vsliv695:30137379
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythontb:30258533
pythonptprofiler:30281269
vshan820:30294714
vscod805:30301674
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30404738
cppdebug:30492333
vsclangdf:30492506
c4g48928:30535728
dsvsc012:30540252
pynewext54:30618038
pylantcb52:30590116
pyind779:30611226
pythonsymbol12:30651887
showlangstatbar:30737417
pythonms35:30671666
03d35959:30757351
57b77579:30687741
pythonfmttext:30716741
pythoncmvfstr:30726892
fixshowwlkth:30724385
showsbindicator:30724477
pythongtdpath:30726887
pythonnosmt12:30757129

```

</details>

<!-- generated by issue reporter -->