GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add experimental lazy metadata for provider output by powercode · Pull Request #28284 · PowerShell/PowerShell

Conversation

@powercode

@powercode Staffan Gustafsson (powercode) commented Oct 29, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

PR Summary

Add PSOptimizedProviderObjects, an experimental feature that avoids allocating provider note properties until they are needed.

FileSystem items and scalar Get-Content strings/bytes store metadata inline in PSObject<TMetadata>. Property reads use compiled getters; member inspection or mutation materializes ordinary PSNoteProperty objects. Content outputs share cached paths and keep their own ReadCount. Batches, byte arrays, and other providers use the existing path.

Enable-ExperimentalFeature PSOptimizedProviderObjects
# Restart PowerShell.

One behavior change: lazy FileSystem path properties follow the underlying object's current path after a move. Once materialized, they become snapshots. Drive/provider context, Unix stat, and content paths retain their captured values.

Performance

Measures of Get-ChildItem | ... for different scenarios with different usage of the PS* provider properties.

Elapsed time and allocated bytes per filesystem item relative to master

Master is 100% (dashed line); lower is better. Left: elapsed time. Right: allocated bytes per item.

  • Emission: 55.4% less time, 67.3% fewer allocated bytes.
  • One PSPath read per item: 52.3% less time, 58.2% fewer allocated bytes.
  • Ten reads: 51.6% less time, but 14.1% more allocated bytes, as path strings are recomputed.
  • Formatting and Select-Object * show little improvement.

Measured on an i9-13900K with fast disks. Your mileage may vary.

Tests and docs

Adds xUnit and Pester coverage for lazy reads, mutation, binding, copying, serialization, object lifetime, content metadata, and feature-on/off behavior. Includes a process-isolated benchmark harness and an engine design guide at docs/building/provider-instance-metadata.md.

image

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge. If this PR is a work in progress, please open this as a Draft Pull Request and mark it as Ready to Review when it is ready to merge.
  • Breaking changes
    • None
    • OR
    • Experimental feature(s) needed
      • Experimental feature name(s): PSOptimizedProviderObjects
  • User-facing changes
    • Not Applicable
    • OR
    • Documentation needed
      • Issue filed:
  • Testing - New and feature
    • N/A or can only be tested interactively
    • OR
    • Make sure you've added a new test if existing tests do not effectively test the code changed

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@azure-pipelines

azure-pipelines Bot commented Oct 29, 2026

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@powercode Staffan Gustafsson (powercode) added WG-Engine core PowerShell engine, interpreter, and runtime CL-Engine Indicates that a PR should be marked as an engine change in the Change Log labels Oct 29, 2026
@powercode
Staffan Gustafsson (powercode) force-pushed the Perf/FileInfoPsProps branch from 87346cc to a349e6f Compare October 29, 2026 17:25
@microsoft-github-policy-service microsoft-github-policy-service Bot added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Nov 2, 2026
@powercode
Staffan Gustafsson (powercode) requested a balanced review from Copilot November 2, 2026 08:58
@microsoft-github-policy-service microsoft-github-policy-service Bot removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Nov 2, 2026
Copilot started reviewing on behalf of Staffan Gustafsson (powercode) November 2, 2026 08:59
View session
Copilot AI reviewed Nov 2, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved wrapper-unwrapping regressions break .NET argument handling, property assignments, and Boolean binding, while an incorrect path causes the new filesystem test to fail on Unix.

7 open issues
  • High severity Unwrap PSObject subclasses for object arguments and setters · New
  • High severity Add a directory separator to the Unix test path · New
  • Medium severity Fix the launch task name and executable path · New
  • Medium severity Remove or update the workstation-specific WSL launch profile · New
  • Medium severity Resolve helper paths relative to the script checkout · New
  • Medium severity Unwrap wrapped byte values during Boolean parameter conversion · New
  • Medium severity Replace the hard-coded obsolete debug executable path · New
What changed in this PR

Adds the opt-in PSOptimizedProviderObjects feature to reduce provider-output allocations by deferring note-property creation until member inspection or mutation requires it.

Changes:

  • Introduces inline metadata and lazy property access for FileSystem items and scalar Get-Content output.
  • Adds regression coverage, isolated performance benchmarks, and engine design documentation.
  • Updates debugger configuration, solution mappings, and small provider/console-host details.
File Description
TestDir/​test.ps1 Adds a local FileSystem test helper.
test/​xUnit/​csharp/​test_PSObject.cs Tests lazy access, promotion, identity, copying, serialization, and allocations.
test/​powershell/​Modules/​Microsoft.PowerShell.Management/​OptimizedProviderObjects.Tests.ps1 Adds feature-dependent provider and content integration tests.
test/​powershell/​Modules/​Microsoft.PowerShell.Management/​FileSystem.Tests.ps1 Updates Unix colon-path tests.
test/​perf/​benchmarks/​README.md Documents benchmark usage and measurement interpretation.
test/​perf/​benchmarks/​ProviderMetadata.ProcessBenchmark.ps1 Runs isolated baseline/candidate comparisons and generates reports.
test/​perf/​benchmarks/​assets/​ProviderMetadata.Measure.ps1 Measures item/content scenarios, allocations, and retained memory.
src/​System.Management.Automation/​System.Management.Automation.csproj Defaults UseResharper to false.
src/​System.Management.Automation/​Properties/​launchSettings.json Adds an executable debugger profile.
src/​System.Management.Automation/​namespaces/​RegistryProvider.cs Simplifies default-drive initialization.
src/​System.Management.Automation/​namespaces/​ProviderBase.cs Gates lazy FileSystem metadata attachment and preserves fallback handling.
src/​System.Management.Automation/​namespaces/​FileSystemProvider.cs Adds lexical metadata path helpers and shares path-fix logic.
src/​System.Management.Automation/​engine/​runtime/​Binding/​Binders.cs Separates instance-member presence checks from lazy value reads.
src/​System.Management.Automation/​engine/​ProviderPSObject.cs Implements typed metadata wrappers, compiled accessors, and FileSystem metadata.
src/​System.Management.Automation/​engine/​parser/​Compiler.cs Caches reflection references for new binder helpers.
src/​System.Management.Automation/​engine/​MshObject.cs Adds provider-source attachment and lookup helpers.
src/​System.Management.Automation/​engine/​MshMemberInfo.cs Supports lazy storage and promotion to ordinary note properties.
src/​System.Management.Automation/​engine/​InternalCommands.cs Keeps exact provider-property reads lazy in ForEach-Object.
src/​System.Management.Automation/​engine/​ExperimentalFeature/​ExperimentalFeature.cs Registers PSOptimizedProviderObjects.
src/​System.Management.Automation/​engine/​CommandParameter.cs Expands command-parameter debugger display.
src/​Microsoft.PowerShell.ConsoleHost/​host/​msh/​ConsoleHostRawUserInterface.cs Avoids redundant console-mode changes.
src/​Microsoft.PowerShell.Commands.Management/​commands/​management/​ContentOutputMetadata.cs Defines shared content-path accessors and per-output ReadCount.
src/​Microsoft.PowerShell.Commands.Management/​commands/​management/​ContentCommandBase.cs Emits optimized scalar content and centralizes path caching.
PowerShell.sln Maps Linux and CodeCoverage configurations to Release for affected projects.
docs/​building/​provider-instance-metadata.md Explains metadata design, lifecycle, compatibility, and validation.
docs/​building/​internals.md Summarizes the feature and links its design guide.
.vscode/​launch.json Adds console and WSL debugger configurations.

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/System.Management.Automation/engine/ProviderPSObject.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread .vscode/launch.json Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread .vscode/launch.json Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread TestDir/test.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/Microsoft.PowerShell.Commands.Management/commands/management/ContentCommandBase.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/System.Management.Automation/Properties/launchSettings.json Resolved

Uh oh!

There was an error while loading. Please reload this page.

@powercode
Staffan Gustafsson (powercode) force-pushed the Perf/FileInfoPsProps branch from 949596a to 2577db9 Compare November 2, 2026 22:02
Staffan Gustafsson (powercode) added 3 commits November 2, 2026 23:54
@powercode
Add experimental lazy filesystem provider metadata
43bb93e
@powercode
Add lazy Get-Content metadata and document engine mechanics
3c42083
Use inline ReadCount and shared source context for filesystem string and scalar-byte output. Preserve legacy metadata for raw byte arrays and batches. Include regression coverage, isolated benchmarks, and engine design documentation.
@powercode
Handle metadata PSObject subclasses in argument and setter conversions
d1f7c77
@powercode
Staffan Gustafsson (powercode) force-pushed the Perf/FileInfoPsProps branch from 2577db9 to d1f7c77 Compare November 2, 2026 22:55
@powercode
Staffan Gustafsson (powercode) marked this pull request as ready for review November 3, 2026 00:00
@powercode
Staffan Gustafsson (powercode) requested review from a team, Patrick Meinecke (SeeminglyScience) and Dongbo Wang (daxian-dbw) as code owners November 3, 2026 00:00
@powercode

Staffan Gustafsson (powercode) commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

The 4 failing checks seem to be infrastructure issues.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@powercode
Add provider item object factory protocol
4168e8c
Co-authored-by: Copilot <[email protected]>
@powercode Staffan Gustafsson (powercode) changed the title Add experimental lazy metadata for FileSystem provider output Add experimental lazy metadata for provider output Nov 4, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added the Review - Needed The PR is being reviewed label Nov 11, 2026
@microsoft-github-policy-service

microsoft-github-policy-service Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@daxian-dbw Dongbo Wang (daxian-dbw) Awaiting requested review from daxian-dbw daxian-dbw is a code owner
@SeeminglyScience Patrick Meinecke (SeeminglyScience) Awaiting requested review from SeeminglyScience SeeminglyScience is a code owner

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log Review - Needed The PR is being reviewed WG-Engine core PowerShell engine, interpreter, and runtime

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@powercode
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.