I am digging the speed of the new PowerShell 6.0


Yesterday, I had the pleasure of installing PowerShell 6.0 (pwsh) on my Development machine. You can find it here pwsh (I dig the new name. It is very unix-like)

I work for Microsoft. And a big part of my day is finding the right project/file to modify so I can knock work-items off my list. I use this PowerShell query often to find file names under a directory.

PS5.1 § ferasd-dev C:> ls -Recurse -Filter *.cs

This commands takes a long time for large directories. With pwsh, I noticed the increase in speed. So I thought I would measure the percentage of increase on my machine and share that with you. Here are the commands I ran:

PS5.1 § ferasd-dev {C:\}> $x = 0; $i = 10; 1..$i | %{
           $x += (Measure-Command {ls -Recurse -Filter *.cs -ErrorAction SilentlyContinue}).TotalMilliseconds

The result I got was 10037.42759 milliseconds using PowerShell 5.1.

When I run the same script in pwsh, I get 8813.46947milliseconds.

The increase ~12%. But it compounds when working with large directory with massive amount of files.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s