I've recently gotten back into software development after reinstalling Windows months ago, and I've noticed that using PowerShell has become painfully slow. To give you an idea, here are some of the timings I've recorded: it takes about 8 seconds just to start up before I get a prompt, executing a simple 'ls' command in a folder with only 10 items takes around 15 seconds, and even changing directories using 'cd ..' or 'cd directoryname' takes about 6 seconds. This is making it unusable for me, so I've switched back to the regular command prompt. I tried installing PowerShell 7.5.2, but the issue persisted. I heard that there might be a problem with the profile file, so I checked the profile paths and found out there are no profile files present. Could not having these files be the reason behind the slowness?
1 Answer
It might be a ngen (Native Image Generator) issue causing the slowness. You can try running some scripts to boost PowerShell’s performance. Check out this guide for more details: simeononsecurity.com/guides/boost-powershell-performance-with-ngen/
Thanks, I followed your suggestion! I ran both scripts, and initially, nothing changed. Then I also ran another optimization script and decided to restart my computer. Now PowerShell is super fast, just like before!