Slow powershell startup #4811

Closed
opened 2026-01-30 23:57:08 +00:00 by claunia · 20 comments
Owner

Originally created by @cdmihai on GitHub (Nov 4, 2019).

Originally assigned to: @DHowett-MSFT on GitHub.

Environment

Windows build number: 10.0.18362.0
Windows Terminal version (if applicable): 0.6.2951.0

Any other software?
Powershell 6.2.3

I get slow startup times (~6-7 perceived seconds). It started happening with Terminal 0.5.2762.0. It's particularly annoying when I start splitting off panes left and right.
I ruled out my $Profile script by printing out its execution time as its last command.

Let me know how I can give you any profiled data.

Originally created by @cdmihai on GitHub (Nov 4, 2019). Originally assigned to: @DHowett-MSFT on GitHub. <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 10.0.18362.0 Windows Terminal version (if applicable): 0.6.2951.0 Any other software? Powershell 6.2.3 ``` I get slow startup times (~6-7 perceived seconds). It started happening with Terminal 0.5.2762.0. It's particularly annoying when I start splitting off panes left and right. I ruled out my `$Profile` script by printing out its execution time as its last command. Let me know how I can give you any profiled data.
claunia added the Needs-Tag-FixNeeds-Attention labels 2026-01-30 23:57:08 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Nov 7, 2019):

Interesting. And it doesn't repro if you just run pwsh from Win+R? That's highly unusual.

Incidentally, powershell tells me how long it took to load my user profile every time I start it up, and I don't recall configuring that. Is it doing that here for you too?

@DHowett-MSFT commented on GitHub (Nov 7, 2019): Interesting. And it doesn't repro if you just run pwsh from <kbd>Win+R</kbd>? That's highly unusual. Incidentally, powershell tells me how long it took to load my user profile every time I start it up, and I don't recall configuring that. Is it doing that here for you too?
Author
Owner

@cdmihai commented on GitHub (Nov 7, 2019):

Yes, Powershell is telling me profile scripts load times as well. The startup times difference between the Powershell terminal and Terminal is that Terminal takes slightly longer before and after Powershell writes its times (but the logged times are mostly on par with the Powershell terminal). Maybe it would be useful to log the Terminal overhead before and after invoking the inner shell. Another interesting log would be time to first prompt display, if that's knowable by Terminal.

@cdmihai commented on GitHub (Nov 7, 2019): Yes, Powershell is telling me profile scripts load times as well. The startup times difference between the Powershell terminal and Terminal is that Terminal takes slightly longer before and after Powershell writes its times (but the logged times are mostly on par with the Powershell terminal). Maybe it would be useful to log the Terminal overhead before and after invoking the inner shell. Another interesting log would be time to first prompt display, if that's knowable by Terminal.
Author
Owner

@DHowett-MSFT commented on GitHub (Nov 7, 2019):

Huh, that's interesting. Thanks!

@DHowett-MSFT commented on GitHub (Nov 7, 2019): Huh, that's interesting. Thanks!
Author
Owner

@Fonta commented on GitHub (Mar 9, 2020):

I think I might the same thing here. By times when I start Windows Terminal i simply get a blinking cursor for around 7-10 seconds or so.
This happened when I had pwsh 5.1 as default and now also with pwsh 7 as default.
There's nothing in my profile that gets started.

The weird thing is also that it isn't always slow. A lot of times it's as fast as starting PS normally.

@Fonta commented on GitHub (Mar 9, 2020): I think I might the same thing here. By times when I start Windows Terminal i simply get a blinking cursor for around 7-10 seconds or so. This happened when I had pwsh 5.1 as default and now also with pwsh 7 as default. There's nothing in my profile that gets started. The weird thing is also that it isn't always slow. A lot of times it's as fast as starting PS normally.
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 10, 2020):

Contrasting running pwsh directly, which never takes a long time? I'm somewhat skeptical: we're really just spawning it in the exact same way as always...

@DHowett-MSFT commented on GitHub (Mar 10, 2020): Contrasting running pwsh directly, which _never_ takes a long time? I'm somewhat skeptical: we're really just spawning it in the exact same way as always...
Author
Owner

@cdmihai commented on GitHub (Mar 10, 2020):

@DHowett-MSFT, maybe there's a measurement gap somewhere. My $Profile script prints out its time at the end, and Terminal (or something else) still does something 1-4 seconds after that, until I can type. Ideally it would be nice to measure 3 times;

  • terminal startup to shell invocation
  • shell startup time
  • time from end of shell startup to when user can type stuff
@cdmihai commented on GitHub (Mar 10, 2020): @DHowett-MSFT, maybe there's a measurement gap somewhere. My $Profile script prints out its time at the end, and Terminal (or something else) still does something 1-4 seconds after that, until I can type. Ideally it would be nice to measure 3 times; - terminal startup to shell invocation - shell startup time - time from end of shell startup to when user can type stuff
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 10, 2020):

Terminal (or something else) still does something 1-4 seconds after that, until I can type.

By this point, terminal is just two pipes hooked up to a console process; it cannot introduce further delay between when the shell prints something and accepts input.
Do you, per chance, have a complicated Prompt function?

Regardless, would you mind capturing traces using this WPR profile, using the Console Performance Default Profile? Thanks!

My e-mail (and therefore MS alias ;P) is in my github profile.

@DHowett-MSFT commented on GitHub (Mar 10, 2020): > Terminal (or something else) still does something 1-4 seconds after that, until I can type. By this point, terminal is just two pipes hooked up to a console process; it cannot introduce further delay between when the shell prints something and accepts input. Do you, per chance, have a complicated `Prompt` function? Regardless, would you mind capturing traces using [this WPR profile](https://raw.githubusercontent.com/microsoft/terminal/dev/duhowett/wprp/src/TerminalPerf.wprp), using the `Console Performance Default Profile`? Thanks! My e-mail (and therefore MS alias ;P) is in my github profile.
Author
Owner

@cdmihai commented on GitHub (Mar 11, 2020):

Do you, per chance, have a complicated Prompt function?

I do have posh-git installed, but my startup directory is not in a git repo.

I'll get a recording and send it to you.

@cdmihai commented on GitHub (Mar 11, 2020): >Do you, per chance, have a complicated Prompt function? I do have posh-git installed, but my startup directory is not in a git repo. I'll get a recording and send it to you.
Author
Owner

@ghost commented on GitHub (May 4, 2020):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (May 4, 2020): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@DHowett-MSFT commented on GitHub (May 7, 2020):

@cdmihai guessing that posh-git ended up being the culprit?

@DHowett-MSFT commented on GitHub (May 7, 2020): @cdmihai guessing that posh-git ended up being the culprit?
Author
Owner

@cdmihai commented on GitHub (May 7, 2020):

That's my current lead, per our email discussion. Unfortunately I didn't manage to carve out enough time to study it further, and posh-git is too useful to remove. But one of these days ...

@cdmihai commented on GitHub (May 7, 2020): That's my current lead, per our email discussion. Unfortunately I didn't manage to carve out enough time to study it further, and posh-git is too useful to remove. But one of these days ...
Author
Owner

@archongum commented on GitHub (Oct 19, 2020):

That's my current lead, per our email discussion. Unfortunately I didn't manage to carve out enough time to study it further, and posh-git is too useful to remove. But one of these days ...

Same here. I need post-git and startup speed too.

@archongum commented on GitHub (Oct 19, 2020): > That's my current lead, per our email discussion. Unfortunately I didn't manage to carve out enough time to study it further, and posh-git is too useful to remove. But one of these days ... Same here. I need `post-git` and startup speed too.
Author
Owner

@DHowett commented on GitHub (Oct 19, 2020):

It would be worth filing a bug on them to get git.exe out of the critical path then!

@DHowett commented on GitHub (Oct 19, 2020): It would be worth filing a bug on them to get git.exe out of the critical path then!
Author
Owner

@danicunhac commented on GitHub (Oct 29, 2020):

I have the same problem :/ Seems like posh really is causing the slow down

@danicunhac commented on GitHub (Oct 29, 2020): I have the same problem :/ Seems like posh really is causing the slow down
Author
Owner

@danicunhac commented on GitHub (Oct 29, 2020):

Link to stackoverflow solution
image

@danicunhac commented on GitHub (Oct 29, 2020): [Link to stackoverflow solution](https://stackoverflow.com/questions/48262269/how-to-i-remove-the-powershell-start-text) ![image](https://user-images.githubusercontent.com/28742636/97610576-d7035800-19f3-11eb-9429-077244c1323c.png)
Author
Owner

@DHowett commented on GitHub (Oct 29, 2020):

I do not know why you have decided that powershell printing 4 lines of text is at all related to its speed.

@DHowett commented on GitHub (Oct 29, 2020): I do not know why you have decided that powershell printing 4 lines of text is at all related to its _speed_.
Author
Owner

@cdmihai commented on GitHub (Oct 29, 2020):

I do not know why you have decided that powershell printing 4 lines of text is at all related to its speed.

I decided to give it a try because why not, and it is indeed a major improvement in startup speed. Seems ridiculous, but alas that's software for ya :)

@cdmihai commented on GitHub (Oct 29, 2020): > I do not know why you have decided that powershell printing 4 lines of text is at all related to its speed. I decided to give it a try because why not, and it is indeed a major improvement in startup speed. Seems ridiculous, but alas that's software for ya :)
Author
Owner

@danicunhac commented on GitHub (Oct 29, 2020):

I didn't decide, it was just a coincidence. I wanted to remove that 4 lines of text and it also improved startup speed (also looks better noew). So yeah :)

@danicunhac commented on GitHub (Oct 29, 2020): I didn't decide, it was just a coincidence. I wanted to remove that 4 lines of text and it also improved startup speed (also looks better noew). So yeah :)
Author
Owner

@DHowett commented on GitHub (Oct 29, 2020):

It's 2020. Weirder things have happened! 😄

@DHowett commented on GitHub (Oct 29, 2020): It's 2020. Weirder things have happened! :smile:
Author
Owner

@AnantTiwari-Naman commented on GitHub (Mar 23, 2021):

-nologo helped me too, ig we can close this issue now

@AnantTiwari-Naman commented on GitHub (Mar 23, 2021): -nologo helped me too, ig we can close this issue now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4811