Skip to content

Investigate why InitialSessionState.CreateDefault2() is slower than CreateDefault() #5104

@SteveL-MSFT

Description

@SteveL-MSFT

CreateDefault2() should only be loading the Core cmdlets module while CreateDefault() loads more, yet CreateDefault2() is 3-8 times slower.

'CreateDefault','CreateDefault2' | %{  (measure-command {
$iss = [InitialSessionState]::$_();
1..100 | % { $ps = [powershell]::Create($iss).AddCommand('echo').AddArgument(1); $ps.Invoke(); $ps.Dispose() } }).TotalMilliseconds }

1190.377
3268.448

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-No ActivityIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimeWG-Engine-Performancecore PowerShell engine, interpreter, and runtime performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions