Skip to content

The globbing code is possibly doing duplicate work when filtering path like C:\Windows\System32\p* #10093

@daxian-dbw

Description

@daxian-dbw

A fast path is added to WildcardPattern.IsMatch for patterns like test*. However, this shows no noticeable improvements to dir -Recurse C:\Windows\System32\p*.
Quoted from @iSazonov's comment #10054 (comment)

When we send a path like C:\Windows\System32\p* to engine our globbing code does all work - parse and expand p* to a collection with leaves. Then the already filtered leaves (in the example, all started with "p") is passed to a code which again filters the leaves by WindcardPattern.IsMatch(). So (1) we don't filter large, all full path list, only small collection of leaves - that's why we get so little acceleration, (2) we do duplicated work that we would address, I believe it is common problem in globbing code - there is many places where it happens.

So it's possible our globing code is doing duplicate filtering, and it would be an optimization opportunity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-FileSystem-Providerspecific to the FileSystem providerIssue-Enhancementthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management moduleWG-Engine-Performancecore PowerShell engine, interpreter, and runtime performanceWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions