Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 52.15.69.226
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : sortperf.pyo
�
?��cc@s�dZddlZddlZddlZddlZddlZddlZej�Zd�Z	d�Z
d�Zd�Zd�Z
edkr�e
�ndS(	s_Sort performance test.

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

i����NcCsltjjtd|�}yt|d�}Wn�tk
r�tj}gt|�D]}|�^qR}ylz3t|d�}tj	||�|j
�d}Wd|r�ytj|�Wq�tj
k
r�q�XnXWqhtk
r�}dG|GdG|GHqhXnkXtj|�}|j
�xNtd�D]@}tj|�}|| }||4|j�|j|�~q$W|S(s+Return a list of n random floats in [0, 1).srr%06dtrbtwbNscan't writet:i
(tostpathtjointtdtopentIOErrortrandomtxrangetmarshaltdumptclosetNonetunlinkterrortloadtranget	randrangetreversetextend(tntfntfptrtitresulttmsgttemp((s4/usr/local/python-2.7/lib/python2.7/test/sortperf.pyt
randfloatss:
	"





cCstjj�dS(N(tsyststdouttflush(((s4/usr/local/python-2.7/lib/python2.7/test/sortperf.pyR!8scCs9tj�}|j�tj�}d||Gt�dS(Ns%6.2f(ttimetclocktsortR!(tLtt0tt1((s4/usr/local/python-2.7/lib/python2.7/test/sortperf.pytdoit;s

cCs;tgdD]}|d^q
�}ddt|�}|d|GHx�|D]�}d|>}t|�}d||fGt�t|�|j�t|�t|�xOtd	�D]A}tj|�}tj|�}	||	||||<||	<q�Wt|�|d
kr8gtd
�D]}tj�^q|d)nt|�x1t	|d�D]}tj�|tj|�<qSWt|�|d
kr�|d
3||d
}t
d�|�}nt|�~t
tdg|�}t|�~|d}
t|
ddd�}|jt|
��t
t
|�}t|�HqKWdS(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����idicSs|S(N((tx((s4/usr/local/python-2.7/lib/python2.7/test/sortperf.pyt<lambda>ytg�ii����N(Rs2**i(ttupletlenRR!R(RRR	RR
tmaptabsRtfloat(RtchtcasestfmtRRR%tdummyti1ti2thalf((s4/usr/local/python-2.7/lib/python2.7/test/sortperf.pyttabulateBsL#






!
,





cCs�d}d}tjdr�ttjd�}}tjdr�ttjd�}tjdr�d}x)tjdD]}d|t|�}qqWtj|�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(RtargvtintthashR	tseedRR8(tk1tk2R)taR((s4/usr/local/python-2.7/lib/python2.7/test/sortperf.pytmain�s	


t__main__(t__doc__RR"R	RttempfileRt
gettempdirRRR!R(R8R@t__name__(((s4/usr/local/python-2.7/lib/python2.7/test/sortperf.pyt<module>s	'			L	
© 2025 GrazzMean