Skip to content

Conversation

@xtqqczze
Copy link
Contributor

@xtqqczze xtqqczze commented Nov 30, 2020

PR Summary

Avoid IEnumerable<string> -> ToArray -> IEnumerable<string> round-trip.

  • Replace GetDirectories with EnumerateDirectories
  • Replace GetFiles with EnumerateFiles

PR Context

I considered removing the Linq methods from the class, but GetDirectories and GetFiles are implemented using Linq ToArray and an internal method IEnumerable<string> InternalEnumeratePaths, so we have to load the Linq assembly anyway.

Contributes to #14318.

PR Checklist

@ghost ghost assigned TravisEz13 Nov 30, 2020
@daxian-dbw
Copy link
Member

@xtqqczze I'm afraid you need to rebase to fix the markdown URL check failure. It was fixed by #14297

@xtqqczze xtqqczze force-pushed the linq-PowerShellAssemblyLoadContext2 branch from 9f21d12 to ff4129b Compare December 2, 2020 09:48
@xtqqczze xtqqczze marked this pull request as ready for review December 2, 2020 09:49
Copy link
Member

@daxian-dbw daxian-dbw left a comment

Choose a reason for hiding this comment

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

LGTM. The change would avoid the unnecessary ToArray() call in GetDirectories.

@daxian-dbw daxian-dbw merged commit d47864d into PowerShell:master Dec 3, 2020
@daxian-dbw daxian-dbw added the CL-Performance Indicates that a PR should be marked as a performance improvement in the Change Log label Dec 3, 2020
@daxian-dbw daxian-dbw added this to the 7.2.0-preview.2 milestone Dec 3, 2020
@xtqqczze xtqqczze deleted the linq-PowerShellAssemblyLoadContext2 branch December 4, 2020 09:16
@xtqqczze
Copy link
Contributor Author

xtqqczze commented Dec 4, 2020

Submitted #14317 for similar changes in TestModuleManifestCommand.

@ghost
Copy link

ghost commented Dec 15, 2020

🎉v7.2.0-preview.2 has been released which incorporates this pull request.:tada:

Handy links:

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.

4 participants