2

I noticed recently that my powershell 7 prompt takes 5 seconds to load if I have literally anything in my profile. At first I thought it might be my starship prompt but it turns out that it is caused by literally anything being in my profile. If I delete the file or take everything out of it then it loads instantly. Using the Start-Sleep command I was able to figure out that there is an extra 5049 - 5056 ms of delay for no apparent reason.

This delay doesn't occur in powershell 5. It seems like at least 40 - 50 ms of the delay is likely normal startup delay but I cannot figure out where the extra 5 seconds is coming from.

I have tried recompiling my powershell assemblies as mentioned here. I use onedrive for backup of my documents folder but everything is set to exist on device and I moved my config over to the regular documents folder just to double check and there was no change.

I also tried setting my modules to not auto load but it had no change either. From what I can tell, the delay occurs before the profile is actually read, But only if there is actually something to read.

I am currently using powershell 7.5.0, though this was also happening in version 7.4.something.

This is different from this question primarily because the issue goes away if I run with -noprofile or I remove my profile as stated above. It also goes away when running with powershell version 5. It is also not due to a bloated profile because I can have a single command such as get-date and the issue still occurs.

Ramhound
  • 44,080
fishman
  • 21

0 Answers0