FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Minor performance improvements for runspace initialization by iSazonov · Pull Request #10569 · PowerShell/PowerShell · GitHub

Minor performance improvements for runspace initialization - #10569

Merged
Dongbo Wang (daxian-dbw) merged 2 commits into
PowerShell:masterfrom
iSazonov:perf-startup-read-snapins
Oct 15, 2019
Merged

Minor performance improvements for runspace initialization#10569
Dongbo Wang (daxian-dbw) merged 2 commits into
PowerShell:masterfrom
iSazonov:perf-startup-read-snapins

Conversation

Ilya (iSazonov) commented Sep 18, 2019
edited
Loading

Copy link
Copy Markdown
Collaborator

PR Summary

Comments says that the code was optimized in Windows PowerShell but there is still room for improvements that is important for scenarios actively using runspaces and startup.

  1. Remove check that file exist.
    The code came from Windows PowerShell but now all the standard dlls is placed in $PSHome and we have no need to search them in other paths by the dll name.

  2. Remove some obvious allocations

  • Assembly.GetName() allocates - put it in temp variable.
  • Move Version.ToString() out of the cycle.

PR Context

PR Checklist

Ilya (iSazonov) added the CL-Performance Indicates that a PR should be marked as a performance improvement in the Change Log label Sep 18, 2019
Ilya (iSazonov) added this to the 7.0.0-preview.5 milestone Sep 18, 2019

Dongbo Wang (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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Perf win ~2.3%

This comment is not accurate. This code path is hit 4 or 5 times at most when Runspace opens. There are many other places checks for file existence, such as in PowerShellConfig when reading the config json file. So removing this check won't eliminate all FileSystem.FileExist calls.

Dongbo Wang (daxian-dbw) commented Oct 10, 2019
edited
Loading

Copy link
Copy Markdown
Member

Can you update your PR description to not say a 2.3% perf win?
Also, when having a screenshot of profiling result, I suggest to describe what was profiled (e.g. the command executed by PerfView->Run), so there is more context.

Copy link
Copy Markdown
Collaborator Author

PerfView shows follow code paths:

So expected win is up to 1.8%.

I tested Runspace.Open() if I remember right three weeks later :-)

Copy link
Copy Markdown
Member

It's still not accurate as there may be other calls to File.Exist within the code paths hit by RunspaceFactory.CreateRunspace. I suggest to remove the Perf Win part in the PR description.

Copy link
Copy Markdown
Collaborator Author

Done.

Copy link
Copy Markdown
Collaborator Author

Dongbo Wang (@daxian-dbw) Could you please merge?

Dongbo Wang (daxian-dbw) merged commit c76e122 into PowerShell:master Oct 15, 2019

Copy link
Copy Markdown
Member

Ilya (@iSazonov) Sorry I forgot this :)

Ilya (iSazonov) deleted the perf-startup-read-snapins branch October 16, 2019 03:01

Copy link
Copy Markdown

🎉v7.0.0-preview.5 has been released which incorporates this pull request.:tada:

Handy links:

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

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.

2 participants


Back | FazBrowse Home | New Git URL