-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerBreaking-Changebreaking change that may affect usersbreaking change that may affect usersCommittee-ReviewedPS-Committee has reviewed this and made a decisionPS-Committee has reviewed this and made a decisionResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Engine-Performancecore PowerShell engine, interpreter, and runtime performancecore PowerShell engine, interpreter, and runtime performanceWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.
Description
When using Get-ChildItem, the ProviderBase adds these note properties:
PSChildName
PSDrive
PSIsContainer
PSParentPath
PSPath
PSProvider
This is quite expensive, both in terms of memory and execution time.
By replacing the noteproperties with a classes that lazily can compute most of the values, we can save both storage and time.
Timing:
| Command | 6.1-preview | After change | Speedup |
|---|---|---|---|
| GCI -rec -for d:\source\powershell | 0.446 | 0.144 | 3.1 x |
| GCI -rec -for c:\windows -ea:0 | 12.24 | 6.05 | 2 x |
| GCI -rec hkcu:\ -ea:0 | 7.86 | 2.99 | 2.6 x |
Cred to @lzybkr - this was his idea, not mine.
SeeminglyScience, Jaykul, george-chakhidze and mklement0
Metadata
Metadata
Assignees
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerBreaking-Changebreaking change that may affect usersbreaking change that may affect usersCommittee-ReviewedPS-Committee has reviewed this and made a decisionPS-Committee has reviewed this and made a decisionResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Engine-Performancecore PowerShell engine, interpreter, and runtime performancecore PowerShell engine, interpreter, and runtime performanceWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.