Skip to content

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

Closed

Description

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

Activity

  1. added
    WG-Engine-Performance
    on Nov 5, 2017
  2. daxian-dbw commented on Jul 6, 2020

    @daxian-dbw
    Member

    I believe this was addressed by #8341 and other perf related work.

    PS C:\> Remove-Item $PROFILE
    PS C:\> Measure-Command { pwsh.exe -Command { Test-Path $PROFILE } }
    
    Days              : 0
    Hours             : 0
    Minutes           : 0
    Seconds           : 0
    Milliseconds      : 441
    Ticks             : 4414452
    TotalDays         : 5.10931944444444E-06
    TotalHours        : 0.000122623666666667
    TotalMinutes      : 0.00735742
    TotalSeconds      : 0.4414452
    TotalMilliseconds : 441.4452
    
    
    PS C:\> New-Item $PROFILE -Type File -Value ""
    
    
        Directory: C:\Users\rocky\Documents\PowerShell
    
    Mode                 LastWriteTime         Length Name
    ----                 -------------         ------ ----
    -a---            7/6/2020  3:23 PM              0 Microsoft.PowerShell_profile.ps1
    
    PS C:\> Measure-Command { pwsh.exe -Command { Test-Path $PROFILE } }
    
    Days              : 0
    Hours             : 0
    Minutes           : 0
    Seconds           : 0
    Milliseconds      : 438
    Ticks             : 4385962
    TotalDays         : 5.07634490740741E-06
    TotalHours        : 0.000121832277777778
    TotalMinutes      : 0.00730993666666667
    TotalSeconds      : 0.4385962
    TotalMilliseconds : 438.5962
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-FixedWG-Engine-Performance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions