You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Start-Job is now 6-10x slower, and does not preserve $env:PSModulePath #7402
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-No ActivityIssue has had no activity for 6 months or moreWG-Engine-Performancecore PowerShell engine, interpreter, and runtime performance
I should be able to kick off ten jobs in just a few seconds (maybe 2 or 3). When the results of the job come in, I should see Custom PSModulePath. This is the behavior in 5.1.
Actual behavior
It takes between 12 and 20 seconds. That's longer than a second per job! (and I'm not waiting for the job to finish; this is just the time for Start-Job to return) And then the output is the default module path.
Environment data
>$PSVersionTable
Name Value
---------
PSVersion 6.1.0-preview.4
PSEdition Core
GitCommitId 6.1.0-preview.4-26-g668ce91ddb14d71177b4de4f94d99c3e429e4ff7
OS Microsoft Windows 10.0.17692
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
I can Not repro the Perf problem.
In my case time to start jobs in PSCore is in-line with PS Desktop / 5.1 on the same machine.
TotalSeconds : 1.8481092
PS C:\WINDOWS\system32> $psversiontable
Name Value
---- -----
PSVersion 6.1.0-preview.4
PSEdition Core
GitCommitId 6.1.0-preview.4
OS Microsoft Windows 10.0.16299
Thanks Bruce Payette (@BrucePay). I've been wondering how people are handling the schism between the v5 module path and v6. What I did to try to make my life simpler was to use mklink to create directory junctions between the WindowsPowerShell and PowerShell directories (in the user docs and program files dirs) so I can have all my modules in both places. I am not using pwsh a ton yet, so I'm not sure how bad an idea that is. Is there a better way?
Andrew (@anmenaga) and Maximo Trinidad (@MaximoTrinidad) : I tried the latest binary release (this one), and it was indeed faster than my privately-built bits. (I was building and testing using the 'Release' config). Now it is "only" 2x slower. On my system (an old Lenovo X1 Carbon laptop), win5.1 is 2-2.5 seconds, whereas pwsh is 5-6.
On my current hardware (Lenovo X1 Yoga (Intel Core i7, 4 cores, 16 GB RAM)), 5.1 takes about 1.8 or 1.9 seconds to start ten jobs. 6.2.2.0 takes about 3.7 to 3.8 seconds. 7.0.0-preview.5 takes between 4.5 and 5.0 seconds to start ten jobs.
(this is all using binary releases downloaded from github; not my own builds, of course)
Actually, that was on battery power. On AC, the difference is a little less:
version
time
5.1
1.4 - 1.5 seconds
6.2.2.0
2.4 - 2.6 seconds
7.0.0-preview.5
3.3 - 3.5 seconds
But it's still clear that it's getting significantly slower.
Start-Job starts up a new pwsh process, so this is just a symptom showing that there is a degradation in the startup time of pwsh.
I don't find an issue tracking the degradation in the startup time of pwsh, but it's sort of a known issue internally.
From 5.1 to 6.0/6.1/6.2, the worse startup time was mainly because of the use of crossgen vs. ngen. ngen, which is used by powershell.exe, generates more efficient code as it's targeting the particular machine the code runs on; while crossgen has to target a wide range of machines and thus generates code that's less efficient but more resilient.
In 6.2 time frame, #8341 improved the startup time by about 25% comparing with 6.1.
From 6.2 to 7.0, the startup time regressed mainly because .NET Core started to use the Ready-to-Run format for System.Private.CoreLib.dll and maybe a few other core libraries. They were ngen'ed previously.
We probably should open an issue in GitHub tracking the startup time of pwsh, just to make it more transparent to the community.
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-No ActivityIssue has had no activity for 6 months or moreWG-Engine-Performancecore PowerShell engine, interpreter, and runtime performance
Activity
mklement0 commentedon Jul 30, 2018
The performance is concerning, but note that the overriding of
$env:PSModulePathis a more fundamental issue not specific to jobs - see #6850anmenaga commentedon Jul 30, 2018
I can Not repro the Perf problem.
In my case time to start jobs in PSCore is in-line with
PS Desktop / 5.1on the same machine.Dan Thompson (@jazzdelightsme) Your PSVersionTable looks like a manual PS build. Can you please try this repro on official packages on your hardware?
MaximoTrinidad commentedon Jul 30, 2018
In my system both in Windows and Core took 1 sec to execute the script.
Total milliseconds there are small difference:
Windows: 1011.9632 vs Core: 1837.473
But, you're correct about the PSModulePath as it didn't took the new value in PSCore. But, I won't ever mess with the original value in PSModulePath.
I would rather append another path than completely change it.
Receive-Job results:
PSCore
Windows PowerShell
PowerShell Core version:
BrucePay commentedon Jul 31, 2018
The PSModulePath behaviour is currently by design. I have an RFC for how we might change it. Version Specific $ENV:PSModulePath Variables
jazzdelightsme commentedon Aug 1, 2018
Thanks Bruce Payette (@BrucePay). I've been wondering how people are handling the schism between the v5 module path and v6. What I did to try to make my life simpler was to use
mklinkto create directory junctions between theWindowsPowerShellandPowerShelldirectories (in the user docs and program files dirs) so I can have all my modules in both places. I am not using pwsh a ton yet, so I'm not sure how bad an idea that is. Is there a better way?Andrew (@anmenaga) and Maximo Trinidad (@MaximoTrinidad) : I tried the latest binary release (this one), and it was indeed faster than my privately-built bits. (I was building and testing using the 'Release' config). Now it is "only" 2x slower. On my system (an old Lenovo X1 Carbon laptop), win5.1 is 2-2.5 seconds, whereas pwsh is 5-6.
SteveL-MSFT commentedon Nov 4, 2019
Dan Thompson (@jazzdelightsme) is this still an issue with PS7?
jazzdelightsme commentedon Nov 5, 2019
Steve Lee (@SteveL-MSFT) : yes, it is still a problem. In fact it's even worse from 6.2.2.0.
On my current hardware (Lenovo X1 Yoga (Intel Core i7, 4 cores, 16 GB RAM)), 5.1 takes about 1.8 or 1.9 seconds to start ten jobs. 6.2.2.0 takes about 3.7 to 3.8 seconds. 7.0.0-preview.5 takes between 4.5 and 5.0 seconds to start ten jobs.
(this is all using binary releases downloaded from github; not my own builds, of course)
Actually, that was on battery power. On AC, the difference is a little less:
But it's still clear that it's getting significantly slower.
daxian-dbw commentedon Jan 21, 2020
Start-Jobstarts up a newpwshprocess, so this is just a symptom showing that there is a degradation in the startup time ofpwsh.I don't find an issue tracking the degradation in the startup time of
pwsh, but it's sort of a known issue internally.From 5.1 to 6.0/6.1/6.2, the worse startup time was mainly because of the use of
crossgenvs.ngen.ngen, which is used bypowershell.exe, generates more efficient code as it's targeting the particular machine the code runs on; whilecrossgenhas to target a wide range of machines and thus generates code that's less efficient but more resilient.In 6.2 time frame, #8341 improved the startup time by about 25% comparing with 6.1.
From 6.2 to 7.0, the startup time regressed mainly because .NET Core started to use the Ready-to-Run format for
System.Private.CoreLib.dlland maybe a few other core libraries. They were ngen'ed previously.We probably should open an issue in GitHub tracking the startup time of
pwsh, just to make it more transparent to the community.SteveL-MSFT commentedon Jan 22, 2020
The startup perf issue is #6443
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.