Powershell: Quadratic behavior during tab completion

Created on 14 Aug 2020  路  3Comments  路  Source: PowerShell/PowerShell

Steps to reproduce

Open procmon and filter only syscall made by pwsh.exe,

cd C:/a/directory/with/lots/of/files
cd <tab>

Notice how pwsh.exe attempts to list all the files in C:/, then C:/a, then C:/directory, etc, for every directory present in C:/a/directory/with/lots/of/files. Assuming this is a pretty large directory, tab completion could take a very long time.

Screenshot of procmon:
pwsh

I have a feeling #12795 might be related to this issue.

Expected behavior

pwsh.exe should only be listing files/directory once in CWD to do the tab completion. This doesn't reproduce with PowerShell 5.1.

Screenshot of procmon:
powershell

Environment data

% $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0鈥
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Issue-Question WG-Engine-Performance WG-Engine-Providers

All 3 comments

@xavierd just so we cover all the bases, can you verify if this behaviour still presents in the currently released preview?

Yes it does reproduce with:

% $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.1.0-preview.5
PSEdition                      Core
GitCommitId                    7.1.0-preview.5
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0鈥
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

/cc @daxian-dbw @SteveL-MSFT

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rudolfvesely picture rudolfvesely  路  3Comments

JohnLBevan picture JohnLBevan  路  3Comments

HumanEquivalentUnit picture HumanEquivalentUnit  路  3Comments

manofspirit picture manofspirit  路  3Comments

alx9r picture alx9r  路  3Comments