Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Now that's what I call a quick sort!

Charles Dye

Super Moderator
May
5,853
217
Staff member
I've been playing with DIR's /OX "sort-everything-together" option, and I got to wondering just how bad the performance hit from this monster sort really is. So I decided to try to measure its impact. My C:\Windows directory has over 213,000 files; that should be enough to test with. First let's try a few control runs without any sorting:

Code:
C:\>timer dir /a-d /s /ou c:\windows\ ^> nul:
Timer 1 on: 10:23:58
Timer 1 off: 10:24:28  Elapsed: 0:00:30.523

C:\>timer dir /a-d /s /ou c:\windows\ ^> nul:
Timer 1 on: 10:24:37
Timer 1 off: 10:25:08  Elapsed: 0:00:30.204

C:\>timer dir /a-d /s /ou c:\windows\ ^> nul:
Timer 1 on: 10:25:11
Timer 1 off: 10:25:41  Elapsed: 0:00:30.427

C:\>timer dir /a-d /s /ou c:\windows\ ^> nul:
Timer 1 on: 10:25:46
Timer 1 off: 10:26:17  Elapsed: 0:00:30.534

C:\>timer dir /a-d /s /ou c:\windows\ ^> nul:
Timer 1 on: 10:26:23
Timer 1 off: 10:26:54  Elapsed: 0:00:30.399

C:\>timer dir /a-d /s /ou c:\windows\ ^> nul:
Timer 1 on: 10:26:58
Timer 1 off: 10:27:29  Elapsed: 0:00:30.715

C:\>

Dumping my Windows directory, sans sort, takes between 30 and 31 seconds. And now, sorting everything together:

Code:
C:\>timer dir /a-d /s /osx c:\windows\ ^> nul:
Timer 1 on: 10:33:36
Timer 1 off: 10:34:02  Elapsed: 0:00:26.228

C:\>timer dir /a-d /s /osx c:\windows\ ^> nul:
Timer 1 on: 10:34:06
Timer 1 off: 10:34:33  Elapsed: 0:00:26.456

C:\>timer dir /a-d /s /osx c:\windows\ ^> nul:
Timer 1 on: 10:34:46
Timer 1 off: 10:35:12  Elapsed: 0:00:26.228

C:\>timer dir /a-d /s /osx c:\windows\ ^> nul:
Timer 1 on: 10:35:15
Timer 1 off: 10:35:41  Elapsed: 0:00:26.446

C:\>timer dir /a-d /s /osx c:\windows\ ^> nul:
Timer 1 on: 10:35:48
Timer 1 off: 10:36:14  Elapsed: 0:00:26.421

C:\>timer dir /a-d /s /osx c:\windows\ ^> nul:
Timer 1 on: 10:36:16
Timer 1 off: 10:36:42  Elapsed: 0:00:26.430

C:\>

Sorting 213,000 files makes my command about three seconds faster.

I was impressed. It's like quantum computing, with antimatter.
 
Back
Top