Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Avoid array allocations in CorePsAssemblyLoadContext#14291

Merged
daxian-dbw merged 1 commit into
PowerShell:masterPowerShell/PowerShell:masterfrom
xtqqczze:linq-PowerShellAssemblyLoadContext2xtqqczze/PowerShell-PowerShell:linq-PowerShellAssemblyLoadContext2Copy head branch name to clipboard
Dec 3, 2020
Merged

Avoid array allocations in CorePsAssemblyLoadContext#14291
daxian-dbw merged 1 commit into
PowerShell:masterPowerShell/PowerShell:masterfrom
xtqqczze:linq-PowerShellAssemblyLoadContext2xtqqczze/PowerShell-PowerShell:linq-PowerShellAssemblyLoadContext2Copy head branch name to clipboard

Conversation

@xtqqczze

@xtqqczze xtqqczze commented Nov 30, 2020

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

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

Comment thread src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs Outdated
@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

@daxian-dbw daxian-dbw left a comment

Copy link
Copy Markdown
Member

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

xtqqczze commented Dec 4, 2020

Copy link
Copy Markdown
Contributor Author

Submitted #14317 for similar changes in TestModuleManifestCommand.

@ghost

ghost commented Dec 15, 2020

Copy link
Copy Markdown

🎉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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.