Repository navigation
Avoid extra SMB queries when formatting file names - #28038
Open
Dongbo Wang (daxian-dbw) wants to merge 1 commit into
Open
Dongbo Wang (daxian-dbw) wants to merge 1 commit into
Dongbo Wang (daxian-dbw) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Dongbo Wang (daxian-dbw)
September 21, 2026 20:59
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review issues were identified, and regression coverage was added.
Review effort: Lite
Findings: None
What changed in this PR
Improves file-name formatting performance by avoiding unnecessary SMB metadata queries for ordinary items.
Changes:
- Uses cached attributes to short-circuit reparse-point inspection.
- Adds regression coverage for cached metadata behavior.
| File | Description |
|---|---|
test/powershell/Modules/Microsoft.PowerShell.Management/Get-Item.Tests.ps1 |
Verifies cached non-reparse items do not reopen their paths. |
src/System.Management.Automation/namespaces/FileSystemProvider.cs |
Avoids unnecessary metadata queries during formatting. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Contributor
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Summary
NameString.FindFirstFilequery per ordinary item when formatting directory listings, which is particularly expensive on SMB shares.PR Context
Fixes #27088.
IsReparsePointLikeSymlinkmust inspect the reparse tag to distinguish symbolic links and junctions from cloud-drive placeholders. Default formatting previously invoked that expensive check for every item, including ordinary non-links.NameStringnow uses the already-populatedAttributesmetadata to short-circuit ordinary items while preserving detailed classification for actual reparse points.Benchmark
Measured 4,897 entries over the local UNC path
\\localhost\c$\Windows\System32. Each result is the median of three warmed-up runs.NameStringA same-binary control using the fixed debug build isolates the avoided operation:
NameStringIsReparsePointLikeSymlinkprobeThis confirms that the approximately 3.9-second cost came from calling
FindFirstFileonce per item. Absolute formatting times vary between release and debug builds, but the per-item SMB query is eliminated.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header