tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
N\¬Qc@sçdZdZddlmZdZeddƒ\ZZZZ    Z
dd d„ƒYZ dZ d    Z ed
„Zed „Zd    ae ad ad ad    gd aed„tgd ƒadadaed„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z!d„Z"d„Z#d„Z$d„Z%e&dkrãddl'Z'd„Z(e)e'j*ƒdZ+e+dkre(de+ƒnUe+dkrÐye,e'j*dƒZ-WqÖe.k
rÌe(de'j*dƒqÖXneZ-ee-ƒndS(!sâ
"PYSTONE" Benchmark Program
 
Version:        Python/1.1 (corresponds to C/1.1 plus 2 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.
 
iPÃiÿÿÿÿ(tclocks1.1iitRecordcBs)eZdddddd„Zd„ZRS(icCs1||_||_||_||_||_dS(N(tPtrComptDiscrtEnumComptIntCompt
StringComp(tselfRRRRR((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyt__init__-s
                cCs%t|j|j|j|j|jƒS(N(RRRRRR(R((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pytcopy5sN(t__name__t
__module__tNoneRR    (((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyR+s    icCs1t|ƒ\}}dt||fGHd|GHdS(Ns#Pystone(%s) time for %d passes = %gs-This machine benchmarks at %g pystones/second(tpystonest __version__(tloopst    benchtimetstones((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pytmain<scCs
t|ƒS(N(tProc0(R((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyR Csti3cCs|S(N((tx((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyt<lambda>Ksc Csîtƒ}xt|ƒD]}qWtƒ|}tƒatƒatt_tt_tt_    dt_
dt_ d}dt dd<tƒ}x(t|ƒD]}t ƒtƒd}d}d    }t}t||ƒ ax7||kr d
||}    t||ƒ}    |d }qÕWttt ||    ƒttƒad }
xJ|
tkr}|t|
d ƒkrdttƒ}ntt|
ƒd ƒ}
q4W||}    |    |}d|    ||}t|ƒ}q–Wtƒ||} | dkrÚd} n
|| } | | fS(Ni(sDHRYSTONE PROGRAM, SOME STRINGsDHRYSTONE PROGRAM, 1'ST STRINGi
iiiisDHRYSTONE PROGRAM, 2'ND STRINGiitAtCg(RtrangeRt
PtrGlbNexttPtrGlbRtIdent1RtIdent3RRRt
Array2GlobtProc5tProc4tIdent2tFunc2tBoolGlobtProc7tProc8t
Array1GlobtProc1t    Char2GlobtFunc1tProc6tchrtordtProc2( Rt    starttimetitnulltimet
String1LoctIntLoc1tIntLoc2t
String2LoctEnumLoctIntLoc3t    CharIndexRtloopsPerBenchtime((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyROsT
                                     
 
     
cCs­tjƒ|_}d|_|j|_|j|_t|jƒ|_|jtkr”d|_t|jƒ|_tj|_t    |jdƒ|_n |jƒ}d|_|S(Niii
( RR    RRtProc3RRR*RR$R (tPtrParInt
NextRecord((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyR'‰s                cCsM|d}x<tdkr6|d}|t}t}n|tkr Pq q |S(Ni
Ri(t    Char1GlobtIntGlobR(tIntParIOtIntLocR5((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyR-™s
 
 
     cCs4tdk    rtj}ndatdtƒt_|S(Nidi
(RR RR=R$R(t    PtrParOut((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyR9¤s
  cCs"tdk}|pt}dadS(NRtB(R<R#R((tBoolLoc((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyR ®s  cCsdatadS(NR(R<tFALSER#(((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyRµscCs—|}t|ƒst}n|tkr0t}nc|tkrZtdkrQt}q“t}n9|tkrot}n$|tkr~n|tkr“t}n|S(Nid(tFunc3tIdent4RR!R=RtIdent5(t    EnumParInt
EnumParOut((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyR*¼s                                cCs|d}||}|S(Ni((tIntParI1tIntParI2R?t    IntParOut((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyR$Ïs
 
cCs¢|d}|||<||||d<|||d<x)t||dƒD]}||||<qHW|||dd|||d<||||d|<dadS(Niiiii(RR=(t    Array1Part    Array2ParRIRJR?tIntIndex((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyR%Ôs
 
"cCs$|}|}||krtStSdS(N(RR!(tCharPar1tCharPar2tCharLoc1tCharLoc2((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyR)ás
 cCs d}xD|dkrLt||||dƒtkr    d}|d}q    q    W|dkrn|dkrnd}n|dkr~tS||kr˜|d}tStSdS(NiRtWtZitX(R)RtTRUERC(tStrParI1tStrParI2R?tCharLoc((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyR"és!      
cCs|}|tkrtStS(N(RRVRC(RGR5((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyRDús t__main__NcCs6tj|ItjdtjdIJtjdƒdS(Nsusage: %s [number_of_loops]iid(tsyststderrtargvtexit(tmsg((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyterrors s%d arguments are too many;sInvalid argument %r;((/t__doc__tLOOPSttimeRRRRR!RRERFRRVRCRR R=R#R<R(R&tmapRR RRRR'R-R9R RR*R$R%R)R"RDR
R[R`tlenR]tnargstintRt
ValueError(((sT/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/pystone.pyt<module>!sT    :