heapsort shootout rewrite
Henry Cejtin
henry@sourcelight.com
Wed, 20 Jun 2001 01:06:21 -0500
I don't see more than 10% either way, but the code is more readable. Here is
the way I would write it (noopt.sml) and then a tweak to avoid fetching array
elements more than once (opt.sml). The latter only seemed to buy 3% for the
80,000 element case, so it really isn't worth any thing.
begin 600 hsort.tgz
M'XL(`"X],#L"`^U7;6_B1A#F*_X5T^@D;,H9+Z\7$J*K3JF4JKV32J562J/3
M!A8PM==HO207J>IO[\P:$X.`$'(YJ=4^4H(]?G9VWO9E9)+,M9_&4>GU$+`@
MZ+1:I0#1:@3FERW?$6W&\+G;9*V@V>YV.LAO(+$$0>D;8)%JK@!*4R'5PUZ>
M4&GI?P>W"F^K;R%.1J('6`;TYD`5WER->C`5?)XF2OMQI!-9NP/F,\#<L'K0
MJ0<,6+?7/NVQ!HR2Q00NO\SA#8V=:CWOU>OW]_?^+9]$XL%/U*3^#Y'JZ31)
M=++0=2*.51+#0(LY!A]^%^*OE*2_*2[3B&LQR@@K*Y(ACR/?J7J.<\<C2!>W
MT(<?E.(//CX;V6(^PH$K<?;J`(`3X>B(GH@6QDAAS=/3SKN5B*,(H/FNVUV)
MAB1JG+:[S5P4\52C4(DQM!JY,$7--"?S`ZC#KX)'/AE^)35.Y(22>..%A(F0
MG]&W$?H4\R_0=\H`D=`KQ174X7Z7S5$E@[Y'$SS*#>E!<BBSC[U^QC\C(8*T
M59=F5-<-,#RB"3ERZ,\A2RBD`PPIN+(&BO?0(;2!4\P\M`LRD&W$#J44"MRH
M!J%"NN(%3@$Y/<(M!=RP!K/MO`+",<S@O(]Z]_,0FFHDC];L*<4[YSIDJDU@
MRGB4)J;@7,6-8^>%-\P3\YZM-??)##]FM(A2`;/#1U+@#DO+]NAAXM?</MYE
M=[E,C1ZTJ*#3.SM&:P9WEB4#M1P=3PI0J)Z1T7"MX`\;0^OP(&LVXD1+S]EC
M`J[0"$V/MI$VYJ2%BMNP4`R'[%K-9F.B70F/A:TUBC-C82#E`@)G?\KS3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