Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize Get-ChildItem -Recurse -Name #12834

Closed

Conversation

iSazonov
Copy link
Collaborator

@iSazonov iSazonov commented May 29, 2020

PR Summary

Addresses #9119

Intention is to improve performance without changing current behavior. Later we can more easily fix already known bugs/inconsistencies and add new features.

Performance win is up to 50%.
Allocations are dramatically reduces if filtering is used (now no allocations are for discarded paths).

  • Use new .Net Runtime path (folder/file) enumerator in PowerShell file system provider.
  • Refactor existing code to one method.
  • Add more tests (mainly for hidden file attribute)

Today the .Net API does not support:

  • Depth (tracking issue) and we use a workaround in the case.
  • ContinueOnError predicate and we use copy-pasted and bit enhanced code from .Net.

PR Context

Current implementation is a generic (common for all providers) enumerating code which is very expensive. New implementation uses new .Net API for file enumerating. The API is very fast and efficient, especially if filtering is used.

The follow intention is to use this approach later for dir -recurse too and then fix known bugs and add new features.

PR Checklist

@iSazonov iSazonov added the CL-Performance Indicates that a PR should be marked as a performance improvement in the Change Log label May 29, 2020
@iSazonov iSazonov requested a review from anmenaga as a code owner May 29, 2020 09:52
@ghost ghost assigned daxian-dbw May 29, 2020
@iSazonov iSazonov requested a review from SteveL-MSFT May 29, 2020 10:39
@iSazonov iSazonov force-pushed the filesystemprovider-getnames branch from 293d359 to 6c461d5 Compare June 1, 2020 08:45
@iSazonov iSazonov force-pushed the filesystemprovider-getnames branch from 5b8fae2 to d9673b0 Compare June 2, 2020 13:41
@iSazonov iSazonov marked this pull request as ready for review December 17, 2020 16:01
@ghost ghost added the Review - Needed The PR is being reviewed label Dec 25, 2020
@ghost
Copy link

ghost commented Dec 25, 2020

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

@ghost
Copy link

ghost commented Sep 23, 2021

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

@iSazonov iSazonov closed this Apr 23, 2023
@ghost ghost removed the Review - Needed The PR is being reviewed label Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CL-Performance Indicates that a PR should be marked as a performance improvement in the Change Log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants