MOON
Server: Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 FrontPage/5.0.2.2635
System: Linux server.asjudinet.com 2.6.32-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 i686
User: asjudine (504)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: //proc/2/root/usr/lib/python2.4/test/sortperf.pyo
mò
‚=5Dc@s‘dZdkZdkZdkZdkZdkZdkZeiƒZd„Z	d„Z
d„Zd„Zd„Z
edjoe
ƒndS(s_Sort performance test.

See main() for command line syntax.
See tabulate() for output format.

Nc	Cs|tiitd|ƒ}yt|dƒ}Wnßtj
oÓt	i	}g}t|ƒD]}||ƒqW~}ypz3t|dƒ}ti||ƒ|iƒd}Wd|o.yti|ƒWqÞtij
oqÞXnXWqxtj
o}dG|GdG|GHqxXnlXti|ƒ}|iƒxNtdƒD]@}t	i|ƒ}|| }||4|iƒ|i|ƒ~q4W|S(s+Return a list of n random floats in [0, 1).srr%06dtrbtwbNscan't writet:i
(tostpathtjointtdtntfntopentfptIOErrortrandomtrt_[1]txrangetitresulttmarshaltdumptclosetNonetunlinkterrortmsgtloadtranget	randrangettemptreversetextend(	RR
RRRR
RRR((t#/usr/lib/python2.4/test/sortperf.pyt
randfloatssB	*






cCstiiƒdS(N(tsyststdouttflush(((RR#8scCs9tiƒ}|iƒtiƒ}d||GtƒdS(Ns%6.2f(ttimetclocktt0tLtsorttt1R#(R'R)R&((Rtdoit;s

cCsPtg}dD]}||dq~ƒ}ddt|ƒ}|d|GHxý|D]õ}	d|	>}
t	|
ƒ}d|	|
fGtƒt|ƒ|i
ƒt|ƒt|ƒxOtd	ƒD]A}ti|
ƒ}ti|
ƒ}||||||<||<q¹Wt|ƒ|
d
jo5g}td
ƒD]}|tiƒq&~|d)nt|ƒx1t|
dƒD]}tiƒ|ti|
ƒ<qeWt|ƒ|
d
jo+|d
3||
d
}td„|ƒ}nt|ƒ~ttdg|
ƒ}t|ƒ~|
d}t|dddƒ}|it|ƒƒtt|ƒ}t|ƒHqSWdS(s:Tabulate sort speed for lists of various sizes.

    The sizes are 2**i for i in r (the argument, a list).

    The output displays i, 2**i, and the time to sort arrays of 2**i
    floating point numbers with the following properties:

    *sort: random data
    \sort: descending data
    /sort: ascending data
    3sort: ascending, then 3 random exchanges
    +sort: ascending, then 10 random at the end
    %sort: ascending, then randomly replace 1% of the elements w/ random values
    ~sort: many duplicates
    =sort: all equal
    !sort: worst case scenario

    s	*\/3+%~=!R(s%2s %7ss %6sRs2**iis%2d %7dii
iöÿÿÿidicCs|S(N(tx(R+((Rt<lambda>ysf0.5iiÿÿÿÿN(Rs2**i(ttupleRtchtcasestlentfmtR
RRR R'R#R*RRtdummyRRti1ti2RtmaptabsthalfRtfloat(R
R.R1R3R4R'R7R/R2RRR((RttabulateBsT+






!

5






cCsÌd}d}tido‘ttidƒ}}tidohttidƒ}tidoCd}x)tidD]}d|t|ƒ}qtWti	|ƒq§q«nt
||dƒ}t|ƒdS(sÂMain program when invoked as a script.

    One argument: tabulate a single row.
    Two arguments: tabulate a range (inclusive).
    Extra arguments are used to seed the random generator.

    iiiiiiÍ
N(
tk1tk2R!targvtintR+tathashRtseedRR
R9(R>R;R:R
R+((RtmainŽst__main__(t__doc__R!R$RRttempfileRt
gettempdirRR R#R*R9RAt__name__(R*R RDRR#R!R$RRARRR9((Rt?s							'			L