ÿØÿà JFIF      ÿÛ C      

!"$"$ÿÛ C  ÿÂ p " ÿÄ              ÿÄ             ÿÚ    ÕÔË®
(%	aA*‚XYD¡(J„¡E¢RE,P€XYae )(E¤²€B¤R¥	BQ¤¢ X«)X…€¤   @  

  ..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     ÿØÿà JFIF      ÿÛ C      

!"$"$ÿÛ C  ÿÂ p " ÿÄ              ÿÄ             ÿÚ    ÕÔË®
(%	aA*‚XYD¡(J„¡E¢RE,P€XYae )(E¤²€B¤R¥	BQ¤¢ X«)X…€¤   @  

  ..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     
;;Wgc           @   s  d  Z  d Z d d l m Z d Z e d d  \ Z Z Z Z	 Z
 d d  d     YZ d Z d	 Z e d
  Z e d  Z d	 a e a d a d a d	 g d a e d   t g d  a d a d a 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 k rd d l' Z' d   Z( e) e' j*  d Z+ e+ d k re( d e+  nU e+ d k ry e, e' j* d  Z- Wqe. k
 re( d e' j* d  qXn e Z- e 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.

iP  i(   t   clocks   1.1i   i   t   Recordc           B   s)   e  Z d d  d  d  d  d  Z d   Z RS(   i    c         C   s1   | |  _  | |  _ | |  _ | |  _ | |  _ d  S(   N(   t   PtrCompt   Discrt   EnumCompt   IntCompt
   StringComp(   t   selfR   R   R   R   R   (    (    s"   /usr/lib/python2.7/test/pystone.pyt   __init__-   s
    				c         C   s%   t  |  j |  j |  j |  j |  j  S(   N(   R   R   R   R   R   R   (   R   (    (    s"   /usr/lib/python2.7/test/pystone.pyt   copy5   s    N(   t   __name__t
   __module__t   NoneR   R	   (    (    (    s"   /usr/lib/python2.7/test/pystone.pyR   +   s   	i    c         C   s1   t  |   \ } } d t |  | f GHd | GHd  S(   Ns#   Pystone(%s) time for %d passes = %gs-   This machine benchmarks at %g pystones/second(   t   pystonest   __version__(   t   loopst	   benchtimet   stones(    (    s"   /usr/lib/python2.7/test/pystone.pyt   main<   s    c         C   s
   t  |   S(   N(   t   Proc0(   R   (    (    s"   /usr/lib/python2.7/test/pystone.pyR   C   s    s    i3   c         C   s   |  S(   N(    (   t   x(    (    s"   /usr/lib/python2.7/test/pystone.pyt   <lambda>K   t    c         C   s  t    } x t |   D] } q Wt    | } t   a t   a t t _ t t _ t t _	 d t _
 d t _ d } d t d d <t    } x(t |   D]} t   t   d } d } d	 } t } t | |  a x7 | | k  rd
 | | }	 t | |  }	 | d } q Wt t t | |	  t t  a d }
 xJ |
 t k r}| t |
 d  k rdt t  } n  t t |
  d  }
 q4W| | }	 |	 | } d |	 | | } t |  } q Wt    | | } | d k rd } n
 |  | } | | f S(   Ni(   s   DHRYSTONE PROGRAM, SOME STRINGs   DHRYSTONE PROGRAM, 1'ST STRINGi
   i   i   i   i   s   DHRYSTONE PROGRAM, 2'ND STRINGi   i   t   At   Cg        (   R    t   rangeR   t
   PtrGlbNextt   PtrGlbR   t   Ident1R   t   Ident3R   R   R   t
   Array2Globt   Proc5t   Proc4t   Ident2t   Func2t   BoolGlobt   Proc7t   Proc8t
   Array1Globt   Proc1t	   Char2Globt   Func1t   Proc6t   chrt   ordt   Proc2(   R   t	   starttimet   it   nulltimet
   String1Loct   IntLoc1t   IntLoc2t
   String2Loct   EnumLoct   IntLoc3t	   CharIndexR   t   loopsPerBenchtime(    (    s"   /usr/lib/python2.7/test/pystone.pyR   O   sT    
									

	
c         C   s   t  j   |  _ } d |  _ |  j | _ |  j | _ t | j  | _ | j t k r d | _ t |  j  | _ t  j | _ t	 | j d  | _ n | j   }  d  | _ |  S(   Ni   i   i
   (   R   R	   R   R   t   Proc3R   R   R*   R   R$   R   (   t   PtrParInt
   NextRecord(    (    s"   /usr/lib/python2.7/test/pystone.pyR'      s    			c         C   sN   |  d } x= t  d k r6 | d } | t }  t } n  | t k r Pq q W|  S(   Ni
   R   i   (   t	   Char1Globt   IntGlobR   (   t   IntParIOt   IntLocR5   (    (    s"   /usr/lib/python2.7/test/pystone.pyR-      s    


	c         C   s4   t  d  k	 r t  j }  n d a t d t  t  _ |  S(   Nid   i
   (   R   R   R   R=   R$   R   (   t	   PtrParOut(    (    s"   /usr/lib/python2.7/test/pystone.pyR9      s
    c          C   s"   t  d k }  |  p t }  d a d  S(   NR   t   B(   R<   R#   R(   (   t   BoolLoc(    (    s"   /usr/lib/python2.7/test/pystone.pyR       s    c           C   s   d a  t a d  S(   NR   (   R<   t   FALSER#   (    (    (    s"   /usr/lib/python2.7/test/pystone.pyR      s    c         C   s   |  } t  |   s t } n  |  t k r0 t } nc |  t k rZ t d k rQ t } q t } n9 |  t k ro t } n$ |  t k r~ n |  t k r t } n  | S(   Nid   (   t   Func3t   Ident4R   R!   R=   R   t   Ident5(   t	   EnumParInt
   EnumParOut(    (    s"   /usr/lib/python2.7/test/pystone.pyR*      s     						c         C   s   |  d } | | } | S(   Ni   (    (   t   IntParI1t   IntParI2R?   t	   IntParOut(    (    s"   /usr/lib/python2.7/test/pystone.pyR$      s    

c         C   s   | d } | |  | <|  | |  | d <| |  | d <x) t  | | d  D] } | | | | <qH W| | | d d | | | d <|  | | | d | <d a d  S(   Ni   i   i   i   i   (   R   R=   (   t	   Array1Part	   Array2ParRI   RJ   R?   t   IntIndex(    (    s"   /usr/lib/python2.7/test/pystone.pyR%      s    

"c         C   s$   |  } | } | | k r t  St Sd  S(   N(   R   R!   (   t   CharPar1t   CharPar2t   CharLoc1t   CharLoc2(    (    s"   /usr/lib/python2.7/test/pystone.pyR)      s
    c         C   s   d } xD | d k rL t  |  | | | d  t k r	 d } | d } q	 q	 W| d k rn | d k rn d } n  | d k r~ t S|  | k r | d } t St Sd  S(   Ni   R   t   Wt   Zi   t   X(   R)   R   t   TRUERC   (   t   StrParI1t   StrParI2R?   t   CharLoc(    (    s"   /usr/lib/python2.7/test/pystone.pyR"      s    !	
c         C   s   |  } | t  k r t St S(   N(   R   RV   RC   (   RG   R5   (    (    s"   /usr/lib/python2.7/test/pystone.pyRD      s     t   __main__Nc         C   s6   t  j |  It  j d t  j d IJt  j d  d  S(   Ns   usage: %s [number_of_loops]i    id   (   t   syst   stderrt   argvt   exit(   t   msg(    (    s"   /usr/lib/python2.7/test/pystone.pyt   error  s    s   %d arguments are too many;s   Invalid argument %r;(    (/   t   __doc__t   LOOPSt   timeR    R   R   R   R!   R   RE   RF   R   RV   RC   R   R   R=   R#   R<   R(   R&   t   mapR   R   R   R   R   R'   R-   R9   R    R   R*   R$   R%   R)   R"   RD   R
   R[   R`   t   lenR]   t   nargst   intR   t
   ValueError(    (    (    s"   /usr/lib/python2.7/test/pystone.pyt   <module>!   sT   :			
									 