Re:Microsoft Replaces Command Prompt with PowerShell in Late...
by taspeotis on Friday November 18, 2016 @08:43AM
(#12986658)
Measure-Command {dir C:\}
TotalMilliseconds : 2.9708
Measure-Command {Get-ChildItem "C:\"}
TotalMilliseconds : 2.4161
Re:Microsoft Replaces Command Prompt with PowerShell in Late...
by jeeva on Friday November 18, 2016 @11:23AM
(#12987832)
I feel like I should point out that `Measure-Command {dir C:\}` is just aliasing gci.
PS> Measure-Command {Start-Process cmd -ArgumentList '/c dir c:\'}
TotalMilliseconds : 14.0138
PS> Measure-Command {gci C:\}
TotalMilliseconds : 10.7484
Second run on each of those went down to closer to 40% of each, yay caching.Of course, the start-process is possibly taking up a chunk of time, there. With no measure-command for cmd, it makes it a little harder to gauge.
Re:Microsoft Replaces Command Prompt with PowerShell in Late...
by pritambaral on Friday November 18, 2016 @09:37AM
(#12987003)
Compare it with cmd.exe's dir
Re:Microsoft Replaces Command Prompt with PowerShell in Late...
by Already__Taken on Friday November 18, 2016 @10:04AM
(#12987189)
c:\temp>timecmd dir c:\
Volume in drive C is Windows
Volume Serial Number is A0A8-6684
Directory of c:\
01/11/2016 12:45 <DIR> AMD
...
17/11/2016 12:52 <DIR> Windows
9 File(s) 25,337 bytes
18 Dir(s) 71,423,356,928 bytes free
command took 0:0:0.08 (0.08s total)
bat from http://stackoverflow.com/a/6209392
Re:Microsoft Replaces Command Prompt with PowerShell in Late...
by taspeotis on Friday November 18, 2016 @09:57AM
(#12987131)
I have had a quick look through here [1] and most of the answers involve timing precision of two significant digits. By that metric, PowerShell's 2.4ms clocks in at 0.00 seconds. Which means cmd.exe (at a precision of two significant digits) can't beat it.
[1] http://stackoverflow.com/questions/673523/how-to-measure-exe...
Re:Microsoft Replaces Command Prompt with PowerShell in Late...
by Arnavion on Friday November 18, 2016 @04:24PM
(#12990207)
"2.4" or "0.0024" or "24000" all have two significant digits. Leading and trailing zeros don't count as significant digits.
Re:Microsoft Replaces Command Prompt with PowerShell in Late...
by taspeotis on Friday November 18, 2016 @06:32PM
(#12990925)
My mistake, you are right [1]. Thanks for the correction.
Re:Microsoft Replaces Command Prompt with PowerShell in Late...
by jodrellblank on Friday November 18, 2016 @01:14PM
(#12988786)
and find that command prompt dir is faster because it's doing less, because it's less capable. It's not creating System.IO.FileInfo and DirectoryInfo objects for each thing in the directory.
More seriously, how many seconds did it took for the PS to answer to that command?