microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.24k stars 29.3k forks source link

Terminal suggest: Git branch completions can take a long time #224690

Closed Tyriar closed 3 months ago

Tyriar commented 3 months ago

Repro:

  1. Windows/pwsh
  2. Suggest enabled
  3. Open vscode repo window, ideally one that has been long lived and has many local branches
  4. Type git
  5. Type -b, 🐛 the terminal freezes for several seconds

Recording 2024-08-03 at 07 08 21

Tyriar commented 3 months ago

Cause:

image

image

Local branches:

image

Tyriar commented 3 months ago

After deleting local branches:

image

Seems to be no change after pruning and gc.

I wonder what the overhead is building the completion items:

image

Tyriar commented 3 months ago

Select-Object here adds a bit of overhead:

https://github.com/microsoft/vscode/blob/fcecd7061ffda75fdef6e9a1a4a092e745a82423/src/vs/workbench/contrib/terminal/browser/media/GitTabExpansion.psm1#L547-L558

image

VscodeCompletion a little:

image

Tyriar commented 3 months ago

Maybe unique check should be done on client side, this is without Select-Object -Unique:

image