4 ms·
Sure, go ahead, ruin my joke :) More seriously, how many seconds did it took for the PS to answer to that command?
by pawadu 10y ago
Sure, go ahead, ruin my joke :)
More seriously, how many seconds did it took for the PS to answer to that command?
- taspeotis 10y agoMeasure-Command {dir C:\} TotalMilliseconds : 2.9708 Measure-Command {Get-ChildItem "C:\"} TotalMilliseconds : 2.4161
- pritambaral 10y agoCompare it with cmd.exe's dir
- taspeotis 10y agoI 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-execution-time-of-command-in-windows-command-line http://stackoverflow.com/questions/673523/how-to-measure-exe...
- Arnavion 10y ago"2.4" or "0.0024" or "24000" all have two significant digits. Leading and trailing zeros don't count as significant digits.
- taspeotis 10y agoMy mistake, you are right [1]. Thanks for the correction. [1] https://en.m.wikipedia.org/wiki/Significant_figures https://en.m.wikipedia.org/wiki/Significant_figures
- Already__Taken 10y agoc:\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 http://stackoverflow.com/a/6209392
- jodrellblank 10y agoand 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.
- 0xfeba 10y agoSecond time the HD has probably cached the result...
- snuxoll 10y agoMeasure-Command { gci C:\ } TotalMilliseconds : 1.3334 It's pretty fast
- jeeva 10y agoI 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.