%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core18/current/usr/lib/python3.6/test/__pycache__/
Upload File :
Create Path :
Current File : //snap/core18/current/usr/lib/python3.6/test/__pycache__/pystone.cpython-36.pyc

3

/�$h1�@s�dZdZddlmZdZedd�\ZZZZZ	Gdd�d�Z
dZdZefd	d
�Z
efdd�Zdaead
ad
adgdadd�tgdD�adadaefdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Z d&d'�Z!d(d)�Z"e#d*k�r�ddl$Z$d+d,�Z%e&e$j'�dZ(e(dk�r4e%d-e(�nLe(dk�r|ye)e$j'd�Z*Wn(e+k
�rxe%d.e$j'd�YnXneZ*e
e*�dS)/aD
"PYSTONE" Benchmark Program

Version:        Python/1.2 (corresponds to C/1.1 plus 3 Pystone fixes)

Author:         Reinhold P. Weicker,  CACM Vol 27, No 10, 10/84 pg. 1013.

                Translated from ADA to C by Rick Richardson.
                Every method to preserve ADA-likeness has been used,
                at the expense of C-ness.

                Translated from C to Python by Guido van Rossum.

Version History:

                Version 1.1 corrects two bugs in version 1.0:

                First, it leaked memory: in Proc1(), NextRecord ends
                up having a pointer to itself.  I have corrected this
                by zapping NextRecord.PtrComp at the end of Proc1().

                Second, Proc3() used the operator != to compare a
                record to None.  This is rather inefficient and not
                true to the intention of the original benchmark (where
                a pointer comparison to None is intended; the !=
                operator attempts to find a method __cmp__ to do value
                comparison of the record).  Version 1.1 runs 5-10
                percent faster than version 1.0, so benchmark figures
                of different versions can't be compared directly.

                Version 1.2 changes the division to floor division.

                Under Python 3 version 1.1 would use the normal division
                operator, resulting in some of the operations mistakenly
                yielding floats. Version 1.2 instead uses floor division
                making the benchmark an integer benchmark again.

iP��)�timez1.2��c@seZdZddd�Zdd�ZdS)�RecordNrcCs"||_||_||_||_||_dS)N)�PtrComp�Discr�EnumComp�IntComp�
StringComp)�selfrrrr	r
�r�"/usr/lib/python3.6/test/pystone.py�__init__4s
zRecord.__init__cCst|j|j|j|j|j�S)N)rrrrr	r
)rrrr
�copy<szRecord.copy)Nrrrr)�__name__�
__module__�__qualname__rrrrrr
r2s
rcCs.t|�\}}tdt||f�td|�dS)Nz#Pystone(%s) time for %d passes = %gz-This machine benchmarks at %g pystones/second)�pystones�print�__version__)�loops�	benchtimeZstonesrrr
�mainCsrcCst|�S)N)�Proc0)rrrr
rJsr��3cCsg|]}|dd��qS)Nr)�.0�xrrr
�
<listcomp>RsrNc
Cspt�}xt|�D]}qWt�|}t�at�att_tt_tt_	dt_
dt_d}dtdd<t�}x�t|�D]�}t
�t�d}d}d	}t}t||�ax*||kr�d
||}	t||�}	|d}q�Wttt||	�tt�ad}
x6|
tk�r|t|
d
�k�rtt�}tt|
�d�}
q�W||}	|	|}d|	||}t|�}qlWt�||}|dk�r`d}n||}||fS)N�(zDHRYSTONE PROGRAM, SOME STRINGzDHRYSTONE PROGRAM, 1'ST STRING�
����zDHRYSTONE PROGRAM, 2'ND STRING�r�A�Cg)r�ranger�
PtrGlbNext�PtrGlbr�Ident1r�Ident3rr	r
�
Array2Glob�Proc5�Proc4�Ident2�Func2�BoolGlob�Proc7�Proc8�
Array1Glob�Proc1�	Char2Glob�Func1�Proc6�chr�ord�Proc2)
rZ	starttime�iZnulltimeZ
String1LocZIntLoc1ZIntLoc2Z
String2Loc�EnumLocZIntLoc3Z	CharIndexrZloopsPerBenchtimerrr
rVsT




rcCsvtj�|_}d|_|j|_|j|_t|j�|_|jtkrdd|_t|j�|_tj|_t	|jd�|_n|j�}d|_|S)Nr%rr )
r*rrr	�Proc3rr+r9rr3)ZPtrParInZ
NextRecordrrr
r6�s
r6cCs8|d}x*tdkr&|d}|t}t}|tkr
Pq
W|S)Nr r&r)�	Char1Glob�IntGlobr+)ZIntParIO�IntLocr>rrr
r<�sr<cCs$tdk	rtj}ndatdt�t_|S)N�dr )r*rrAr3r	)Z	PtrParOutrrr
r?�s
r?cCstdk}|pt}dadS)Nr&�B)r@r2r7)ZBoolLocrrr
r/�sr/cCsdatadS)Nr&)r@�FALSEr2rrrr
r.�sr.cCsb|}t|�st}|tkrt}n@|tkr:tdkr4t}q^t}n$|tkrHt}n|tkrRn|tkr^t}|S)NrC)�Func3�Ident4r+r0rAr,�Ident5)�	EnumParInZ
EnumParOutrrr
r9�s r9cCs|d}||}|S)Nr#r)�IntParI1�IntParI2rBZ	IntParOutrrr
r3�sr3cCs�|d}|||<||||d<|||d<x"t||d�D]}||||<q<W|||dd|||d<||||d|<dadS)Nr%r�r#�)r(rA)Z	Array1ParZ	Array2ParrJrKrBZIntIndexrrr
r4�s r4cCs|}|}||krtStSdS)N)r+r0)ZCharPar1ZCharPar2ZCharLoc1ZCharLoc2rrr
r8�s
r8cCstd}x2|dkr6t||||d�tkrd}|d}qW|dkrL|dkrLd}|dkrXtS||krl|d}tStSdS)Nrr&�W�Zr"�X)r8r+�TRUErE)ZStrParI1ZStrParI2rBZCharLocrrr
r1�s
r1cCs|}|tkrtStS)N)r,rQrE)rIr>rrr
rFsrF�__main__cCs6t|dtjd�tdtjdtjd�tjd�dS)N� )�end�filezusage: %s [number_of_loops]r)rUrC)r�sys�stderr�argv�exit)�msgrrr
�errorsr[z%d arguments are too many;zInvalid argument %r;),�__doc__ZLOOPSrrr(r+r0r,rGrHrrQrErrrAr2r@r7r5r-r*r)rr6r<r?r/r.r9r3r4r8r1rFrrVr[�lenrX�nargs�intr�
ValueErrorrrrr
�<module>(sT
:






Zerion Mini Shell 1.0