TIP: Click on subject to list as thread! ANSI
echo: unix
to: Jasen Betts
from: Mathieu Bouchard
date: 1999-01-06 18:19:00
subject: defrag

MB>>  JB> They did that too, the ms-dos sort command is painfully slow,
MB>>  JB> I find it quicker to boot linux to sort a file and then reboot
MB>>  JB> dos!
MB>> Wo, I don't think DOS Sort uses anything less than a QuickSort though.
MB>> It might just be a bad implementation of QuickSort, or at least an
MB>> implementation optimized for data segment size rather than raw speed.
 JB> here's what I got
[...]
 JB> This performance is why I claim that msdos uses bubblesort.

Wow, I really overestimated Microsoft.

DRDOS' sort is not much better, as it can't even read a 2000-line file,
even though it seems to support an O(n log n) sort of some sort. :-)

FOR a = 1 TO 4
  OPEN "o", #1, "foo.tst"
  FOR b = 0 TO a * 400
    PRINT #1, LTRIM$(RTRIM$(STR$(INT(RND * 100000))))
  NEXT b
  CLOSE #1
  zz& = TIMER * 100
  SHELL "sort  nul"
  zz& = TIMER * 100 - zz&
  PRINT zz&
NEXT a

============ results: ================

     a = 1  2  3  4
1st time 22 49 71 93
2nd time 22 55 72 99
3rd time 27 50 71 94

Too bad the granularity of DOS' clock is no more than 18.2 Hz. (Under
Linux it's adjustable, and common values are 100 Hz and 4096 Hz.)

matju

--- Terminate 4.00/Pro
* Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42)
SEEN-BY: 396/1 632/0 371 633/260 262 267 270 284 371 634/397 635/444 506 725
SEEN-BY: 635/728 639/252
@PATH: 163/215 99 12/12 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.