Skip to content

Powershell initialization on linux is slow #1954

@jalons

Description

@jalons

Steps to reproduce

Launch powershell

Expected behavior

Usable prompt in milliseconds

Actual behavior

Usable prompt in seconds

Environment data

PS /> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
PSEdition                      Core
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.9
CLRVersion
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

For example:

[me@ipsum] ~
➜  cat test.ps1
#!/usr/bin/powershell
exit
[me@ipsum] ~
➜  time ./test.ps1
./test.ps1  1.30s user 0.12s system 138% cpu 1.035 total

Compared to:

[me@ipsum] ~
➜  cat test.sh
#/bin/bash
exit
[me@ipsum] ~
➜  time ./test.sh
./test.sh  0.00s user 0.00s system 0% cpu 0.002 total

The windows host I have available:

PS C:\Users\me> echo "exit" > test.ps1
PS C:\Users\me> Measure-Command {.\test.ps1}


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
Milliseconds      : 7
Ticks             : 71141
TotalDays         : 8.23391203703704E-08
TotalHours        : 1.97613888888889E-06
TotalMinutes      : 0.000118568333333333
TotalSeconds      : 0.0071141
TotalMilliseconds : 7.1141



PS C:\Users\me> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      3.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.18033
BuildVersion                   6.2.9200.16434
PSCompatibleVersions           {1.0, 2.0, 3.0}
PSRemotingProtocolVersion      2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-FixedThe issue is fixed.WG-Engine-Performancecore PowerShell engine, interpreter, and runtime performance

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions