Skip to content

Adding a $PROFILE file has significant impact on startup time #5345

@MathiasMagnus

Description

@MathiasMagnus

Nomen est omen.

Steps to reproduce

PS C:\Users\Matty> Remove-Item $PROFILE
PS C:\Users\Matty> Measure-Command { pwsh.exe -Command { Test-Path $PROFILE } }


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 1
Milliseconds      : 121
Ticks             : 11210756
TotalDays         : 1,2975412037037E-05
TotalHours        : 0,000311409888888889
TotalMinutes      : 0,0186845933333333
TotalSeconds      : 1,1210756
TotalMilliseconds : 1121,0756



PS C:\Users\Matty> New-Item $PROFILE -Type File -Value ""


    Directory: C:\Users\Matty\Documents\PowerShell


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----    2017. 11. 05.     17:18              0 Microsoft.PowerShell_profile.ps1


PS C:\Users\Matty> Measure-Command { pwsh.exe -Command { Test-Path $PROFILE } }


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 5
Milliseconds      : 653
Ticks             : 56535473
TotalDays         : 6,54345752314815E-05
TotalHours        : 0,00157042980555556
TotalMinutes      : 0,0942257883333333
TotalSeconds      : 5,6535473
TotalMilliseconds : 5653,5473

Expected behavior

Roughly identical startup times.

Actual behavior

There's a fair 5 seconds difference.

Environment data

PS C:\Users\Matty> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.0-beta.9
PSEdition                      Core
GitCommitId                    v6.0.0-beta.9
OS                             Microsoft Windows 10.0.16232
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS C:\Users\Matty> (Get-ComputerInfo).CsProcessors


Name                      : AMD FX-7500 Radeon R7, 10 Compute Cores 4C+6G
Manufacturer              : AuthenticAMD
Description               : AMD64 Family 21 Model 48 Stepping 1
Architecture              : x64
AddressWidth              : 64
DataWidth                 : 64
MaxClockSpeed             : 2100
CurrentClockSpeed         : 2100
NumberOfCores             : 4
NumberOfLogicalProcessors : 4
ProcessorID               : 178BFBFF00630F01
SocketDesignation         : Socket FS1r2
ProcessorType             : CentralProcessor
Role                      : CPU
Status                    : OK
CpuStatus                 : Enabled
Availability              : RunningOrFullPower

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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions