‡Æ
BNö9c       s©    d  Z  ! # d Z % d k l Z ' d Z ) e d d ƒ \ Z Z Z Z	 Z
 + d f  d „  ƒ  YZ 9 d Z : d Z < d	 „  Z C e d
 „ Z F d Z G e Z H d Z I d Z J d g d Z K e d „  e g d ƒ Z L e Z M e Z O e d „ Z … d „  Z • d „  Z   d „  Z ª d „  Z ± d „  Z ¸ d „  Z  Ë d „  Z! Ð d „  Z" Ý d „  Z# å d „  Z$ ö d „  Z% û e& d j o ü e ƒ  n d S(   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.

i'  (   s   clocks   1.1i   i   s   Recordc      s,   + - e  d d d d d „ Z 5 d „  Z RS(   Nc    sC   - / | |  _  0 | |  _ 1 | |  _ 2 | |  _ 3 | |  _ d  S(   N(   s   PtrComps   selfs   Discrs   EnumComps   IntComps
   StringComp(   s   selfs   PtrComps   Discrs   EnumComps   IntComps
   StringComps)   /mit/python/lib/python2.0/test/pystone.pys   __init__- s
   i    c    s2   5 6 t  |  i |  i |  i 7 |  i |  i ƒ Sd  S(   N(   s   Records   selfs   PtrComps   Discrs   EnumComps   IntComps
   StringComp(   s   selfs)   /mit/python/lib/python2.0/test/pystone.pys   copy5 s   (   s   Nones   __init__s   copy(    s)   /mit/python/lib/python2.0/test/pystone.pys   Record+ s   i    c     s:   < = t  ƒ  \ }  } > d t t |  f GH@ d | GHd  S(   Ns#   Pystone(%s) time for %d passes = %gs-   This machine benchmarks at %g pystones/second(   s   pystoness	   benchtimes   stoness   __version__s   LOOPS(   s	   benchtimes   stoness)   /mit/python/lib/python2.0/test/pystone.pys   main< s   c    s   C D t  |  ƒ Sd  S(   N(   s   Proc0s   loops(   s   loopss)   /mit/python/lib/python2.0/test/pystone.pys   pystonesC s   s    i3   c    s   K |  S(   N(   s   x(   s   xs)   /mit/python/lib/python2.0/test/pystone.pys   <lambda>K s    c    s}  O P Q R S T U V W Y t  ƒ  } Z x t |  ƒ d Z r	 } [ q9 W\ t  ƒ  | } ^ t ƒ  a _ t ƒ  a ` t t _	 a t
 t _ b t t _ c d t _ d d t _ e d } f d t d d <h t  ƒ  } j x{t |  ƒ d j rh} k t ƒ  l t ƒ  m d } n d	 } o d
 } p t } q t | | ƒ a r xE r | | j  o4 s d | | }	 t t | | ƒ }	 u | d } q?Wv t t t | |	 ƒ w t t ƒ a x d }
 y xZ y |
 t! j oI z | t" |
 d ƒ j o { t# t
 ƒ } n | t$ t% |
 ƒ d ƒ }
 q¸W} | | }	 ~ |	 | }  d |	 | | } € t& | ƒ } qå W‚ t  ƒ  | | } ƒ | |  | f Sd  S(   Ni    i(   s   DHRYSTONE PROGRAM, SOME STRINGs   DHRYSTONE PROGRAM, 1'ST STRINGi
   i   i   i   i   s   DHRYSTONE PROGRAM, 2'ND STRINGi   i   s   As   C((   s   clocks	   starttimes   ranges   loopss   is   nulltimes   Records
   PtrGlbNexts   PtrGlbs   PtrComps   Ident1s   Discrs   Ident3s   EnumComps   IntComps
   StringComps
   String1Locs
   Array2Globs   Proc5s   Proc4s   IntLoc1s   IntLoc2s
   String2Locs   Ident2s   EnumLocs   Func2s   BoolGlobs   IntLoc3s   Proc7s   Proc8s
   Array1Globs   Proc1s	   CharIndexs	   Char2Globs   Func1s   Proc6s   chrs   ords   Proc2s	   benchtime(   s   loopss	   starttimes   is   nulltimes
   String1Locs   IntLoc1s   IntLoc2s
   String2Locs   EnumLocs   IntLoc3s	   CharIndexs	   benchtimes)   /mit/python/lib/python2.0/test/pystone.pys   Proc0O sf    		 	

				 	 c    sÝ   … † t  i ƒ  |  _ } ‡ d |  _ ˆ |  i | _ ‰ |  i | _ Š t | i ƒ | _ ‹ | i t j oL Œ d | _  t	 |  i
 ƒ | _
 Ž t  i | _  t | i d ƒ | _ n ‘ | i ƒ  }  ’ t | _ “ |  Sd  S(   Ni   i   i
   (   s   PtrGlbs   copys   PtrParIns   PtrComps
   NextRecords   IntComps   Proc3s   Discrs   Ident1s   Proc6s   EnumComps   Proc7s   None(   s   PtrParIns
   NextRecords)   /mit/python/lib/python2.0/test/pystone.pys   Proc1… s   c    s   • – |  d } — x^ — d oS ˜ t d j o' ™ | d } š | t }  › t } n œ | t j o  Pn q Wž |  Sd  S(   Ni
   i   s   A(   s   IntParIOs   IntLocs	   Char1Globs   IntGlobs   Ident1s   EnumLoc(   s   IntParIOs   IntLocs   EnumLocs)   /mit/python/lib/python2.0/test/pystone.pys   Proc2• s    
c    sO     ¡ £ t  t j	 o ¤ t  i }  n
 ¦ d a § t d t ƒ t  _ ¨ |  Sd  S(   Nid   i
   (   s   PtrGlbs   Nones   PtrComps	   PtrParOuts   IntGlobs   Proc7s   IntComp(   s	   PtrParOuts)   /mit/python/lib/python2.0/test/pystone.pys   Proc3  s   	c     s2   ª « ­ t  d j }  ® |  p t }  ¯ d a d  S(   Ns   As   B(   s	   Char1Globs   BoolLocs   BoolGlobs	   Char2Glob(   s   BoolLocs)   /mit/python/lib/python2.0/test/pystone.pys   Proc4ª s   c      s   ± ² ³ µ d a  ¶ t a d  S(   Ns   A(   s	   Char1Globs   FALSEs   BoolGlob(    s)   /mit/python/lib/python2.0/test/pystone.pys   Proc5± s   	c    sÝ   ¸ ¹ |  } º t |  ƒ o » t } n ¼ |  t j o ½ t } nŒ ¾ |  t j o* ¿ t d j o À t } n
 Â t } nR Ã |  t j o Ä t } n5 Å |  t j o Æ n Ç |  t j o È t } n É | Sd  S(   Nid   (	   s	   EnumParIns
   EnumParOuts   Func3s   Ident4s   Ident1s   Ident2s   IntGlobs   Ident3s   Ident5(   s	   EnumParIns
   EnumParOuts)   /mit/python/lib/python2.0/test/pystone.pys   Proc6¸ s    	c    s(   Ë Ì |  d } Í | | } Î | Sd  S(   Ni   (   s   IntParI1s   IntLocs   IntParI2s	   IntParOut(   s   IntParI1s   IntParI2s   IntLocs	   IntParOuts)   /mit/python/lib/python2.0/test/pystone.pys   Proc7Ë s   c    sÈ   Ð Ñ Ó | d } Ô | |  | <Õ |  | |  | d <Ö | |  | d <× x1 t | | d ƒ d × r } Ø | | | | <q_ WÙ | | | d d | | | d <Ú |  | | | d | <Û d a d  S(   Ni   i   i   i   i    i   (   s   IntParI1s   IntLocs   IntParI2s	   Array1Pars   ranges   IntIndexs	   Array2Pars   IntGlob(   s	   Array1Pars	   Array2Pars   IntParI1s   IntParI2s   IntLocs   IntIndexs)   /mit/python/lib/python2.0/test/pystone.pys   Proc8Ð s    	%c    s;   Ý Þ |  } ß | } à | | j o á t Sn ã t Sd  S(   N(   s   CharPar1s   CharLoc1s   CharLoc2s   CharPar2s   Ident1s   Ident2(   s   CharPar1s   CharPar2s   CharLoc1s   CharLoc2s)   /mit/python/lib/python2.0/test/pystone.pys   Func1Ý s
   		c    sÞ   å æ d } ç xT ç | d j oC è t |  | | | d ƒ t j o é d } ê | d } n q Wë | d j o
 | d j o ì d } n í | d j o î t Sn0 ð |  | j o ñ | d } ò t Sn ô t Sd  S(   Ni   s   As   Ws   Zi   s   X(   s   IntLocs   Func1s   StrParI1s   StrParI2s   Ident1s   CharLocs   TRUEs   FALSE(   s   StrParI1s   StrParI2s   IntLocs   CharLocs)   /mit/python/lib/python2.0/test/pystone.pys   Func2å s   	 %	c    s2   ö ÷ |  } ø | t j o ø t Sn ù t Sd  S(   N(   s	   EnumParIns   EnumLocs   Ident3s   TRUEs   FALSE(   s	   EnumParIns   EnumLocs)   /mit/python/lib/python2.0/test/pystone.pys   Func3ö s   	 s   __main__N('   s   __doc__s   LOOPSs   times   clocks   __version__s   ranges   Ident1s   Ident2s   Ident3s   Ident4s   Ident5s   Records   TRUEs   FALSEs   mains   pystoness   IntGlobs   BoolGlobs	   Char1Globs	   Char2Globs
   Array1Globs   maps
   Array2Globs   Nones   PtrGlbs
   PtrGlbNexts   Proc0s   Proc1s   Proc2s   Proc3s   Proc4s   Proc5s   Proc6s   Proc7s   Proc8s   Func1s   Func2s   Func3s   __name__(    s)   /mit/python/lib/python2.0/test/pystone.pys   ?! s>   		!								6
