Skip to content

Avoid spawning dotnet-suggest at PowerShell startup - #2898

Open
azchohfi wants to merge 1 commit into
dotnet:mainfrom
azchohfi:azchohfi-dotnet-suggest-shim-startup-perf
Open

azchohfi wants to merge 1 commit into
dotnet:mainfrom
azchohfi:azchohfi-dotnet-suggest-shim-startup-perf

Conversation

@azchohfi

Copy link
Copy Markdown

Fixes #2897

The PowerShell shim now reads ~/.dotnet-suggest-registration.txt and the files in ~/.dotnet/tools directly instead of running dotnet-suggest list. It builds the same list, including the dotnet x names for dotnet-x tools. Get-Command only runs if dotnet-suggest isn't in the tools folder.

On my machine the shim went from about 430 ms to 85 ms in pwsh 7.6, and from about 550 ms to 65 ms in Windows PowerShell 5.1 (median of 21 and 15 runs). I checked the list matches dotnet-suggest list exactly and tab completion still works in both.

The completer and the "not installed" message are unchanged. Script version goes to 1.0.3.

The PowerShell shim now reads the registration file and the global tools folder directly instead of running dotnet-suggest list. Fixes dotnet#2897

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dotnet-suggest PowerShell shim slows down every pwsh startup

1 participant