Skip to content

Make the static constructor of PSVersionInfo run faster for stable PowerShell releases#18210

Merged
daxian-dbw merged 7 commits intoPowerShell:masterfrom
daxian-dbw:psv
Oct 6, 2022
Merged

Make the static constructor of PSVersionInfo run faster for stable PowerShell releases#18210
daxian-dbw merged 7 commits intoPowerShell:masterfrom
daxian-dbw:psv

Conversation

@daxian-dbw
Copy link
Copy Markdown
Member

@daxian-dbw daxian-dbw commented Oct 3, 2022

PR Summary

Make the static constructor of PSVersionInfo run faster for stable PowerShell releases.

Major changes are:

  1. Fast parse the pre-defined PowerShell version string, instead of going through SemanticVersion.Parse(string).
  2. Change all legacy versions to use Version instead of SemanticVersion, to avoid the overhead of casting when using them for $PSVersionTable.PSCompatibleVersions.
  3. Simplify the constructor of ConsoleHostRawUserInterface to not use Regex.

PR Checklist

Loading
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 Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants