[Python-checkins] python/nondist/sandbox/parrotbench README.txt, 1.5, 1.6 b.py, 1.6, 1.7 b0.py, 1.8, 1.9 b1.py, 1.3, 1.4 b4.py, 1.3, 1.4 out0, 1.6, 1.7 out4, 1.4, 1.5

gvanrossum at users.sourceforge.net gvanrossum at users.sourceforge.net
Thu Jan 1 00:35:22 EST 2004


Update of /cvsroot/python/python/nondist/sandbox/parrotbench
In directory sc8-pr-cvs1:/tmp/cvs-serv2882

Modified Files:
	README.txt b.py b0.py b1.py b4.py out0 out4 
Log Message:
Version 1.0.2.  Should standardize the repr of dicts.
Also give b.py a main() -- and reduce the stack limit test correspondingly.

Index: README.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/README.txt,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** README.txt	31 Dec 2003 21:53:11 -0000	1.5
--- README.txt	1 Jan 2004 05:35:19 -0000	1.6
***************
*** 1,7 ****
! Parrot benchmark 1.0.1
  ======================
  
! [This is version 1.0.1, with a hopeful bugfix for the Mac OSX issue
! Dan reported.]
  
  This is a benchmark to be run in front of a live audience at OSCON
--- 1,8 ----
! Parrot benchmark 1.0.2
  ======================
  
! [This is version 1.0.2, with a bugfix for the Mac OSX issue that Dan
! reported, and a further bugfix for the dict ordering problem noted by
! Samuele Pedroni.]
  
  This is a benchmark to be run in front of a live audience at OSCON

Index: b.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** b.py	31 Dec 2003 09:04:57 -0000	1.6
--- b.py	1 Jan 2004 05:35:19 -0000	1.7
***************
*** 7,25 ****
  import b6
  
! for i in range(2):
!     print "--> iteration", i
!     print "--> b0"
!     b0.main()
!     print "--> b1"
!     b1.main()
!     print "--> b2"
!     b2.main()
!     print "--> b3"
!     b3.main()
!     print "--> b4"
!     b4.main()
!     print "--> b5"
!     b5.main()
!     print "--> b6"
!     b6.main()
! print "--> All done."
--- 7,29 ----
  import b6
  
! def main():
!     for i in range(2):
!         print "--> iteration", i
!         print "--> b0"
!         b0.main()
!         print "--> b1"
!         b1.main()
!         print "--> b2"
!         b2.main()
!         print "--> b3"
!         b3.main()
!         print "--> b4"
!         b4.main()
!         print "--> b5"
!         b5.main()
!         print "--> b6"
!         b6.main()
!     print "--> All done."
! 
! if __name__ == '__main__':
!     main()

Index: b0.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b0.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** b0.py	31 Dec 2003 21:53:11 -0000	1.8
--- b0.py	1 Jan 2004 05:35:19 -0000	1.9
***************
*** 836,839 ****
--- 836,849 ----
          unInstrumentTree(cls)
  
+ class Dict(dict):
+ 
+     def __repr__(self):
+         keys = self.keys()
+         keys.sort()
+         L = []
+         for key in keys:
+             L.append(repr(key) + ": " + repr(self[key]))
+         return "{" + ", ".join(L) + "}"
+ 
  def main():
      output.reset()
***************
*** 855,859 ****
      checkoutput(1413352820)
  
!     env = {}
      eval(root, env, env)
      g = env['pi']()
--- 865,869 ----
      checkoutput(1413352820)
  
!     env = Dict()
      eval(root, env, env)
      g = env['pi']()
***************
*** 875,879 ****
      root = parser.parse()
      checkoutput(1308798191)
!     env = {}
      eval(root, env, env)
      g = env['pi']()
--- 885,889 ----
      root = parser.parse()
      checkoutput(1308798191)
!     env = Dict()
      eval(root, env, env)
      g = env['pi']()
***************
*** 889,893 ****
      root = parser.parse()
      checkoutput(3257889492)
!     env = {}
      eval(root, env, env)
      g = env['pi']()
--- 899,903 ----
      root = parser.parse()
      checkoutput(3257889492)
!     env = Dict()
      eval(root, env, env)
      g = env['pi']()
***************
*** 895,899 ****
      for i in range(10):
          digits.append(g.next())
!     checkoutput(1177172576)
      print "".join(map(str, digits))
  
--- 905,909 ----
      for i in range(10):
          digits.append(g.next())
!     checkoutput(2832206487)
      print "".join(map(str, digits))
  
***************
*** 903,907 ****
      root = parser.parse()
      checkoutput(0)
!     env = {}
      eval(root, env, env)
      g = env['pi']()
--- 913,917 ----
      root = parser.parse()
      checkoutput(0)
!     env = Dict()
      eval(root, env, env)
      g = env['pi']()
***************
*** 913,917 ****
      checkoutput(0)
  
!     class TrackingDict(dict):
          def __setitem__(self, *args):
              writeln("%s = %.50r" % args)
--- 923,927 ----
      checkoutput(0)
  
!     class TrackingDict(Dict):
          def __setitem__(self, *args):
              writeln("%s = %.50r" % args)

Index: b1.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b1.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** b1.py	31 Dec 2003 09:04:58 -0000	1.3
--- b1.py	1 Jan 2004 05:35:19 -0000	1.4
***************
*** 17,24 ****
  
  def main():
!     print depth0(0) >= 997
      pea = []
      base, p = depth1(0, pea)
!     print base >= 997
      pea.append(p)
      while p[1] is not pea:
--- 17,24 ----
  
  def main():
!     print depth0(0) >= 996
      pea = []
      base, p = depth1(0, pea)
!     print base >= 996
      pea.append(p)
      while p[1] is not pea:

Index: b4.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b4.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** b4.py	31 Dec 2003 21:53:11 -0000	1.3
--- b4.py	1 Jan 2004 05:35:19 -0000	1.4
***************
*** 59,63 ****
  '''
  
! from b0 import Parser, Scanner, getcFromString, Node, eval
  from b0 import instrumentTree, unInstrumentTree, output, checkoutput
  
--- 59,63 ----
  '''
  
! from b0 import Parser, Scanner, getcFromString, Node, eval, Dict
  from b0 import instrumentTree, unInstrumentTree, output, checkoutput
  
***************
*** 68,72 ****
      root = parser.parse()
      instrumentTree(Node)
!     env = {}
      eval(root, env, env)
      heappush = env['heappush']
--- 68,72 ----
      root = parser.parse()
      instrumentTree(Node)
!     env = Dict()
      eval(root, env, env)
      heappush = env['heappush']
***************
*** 82,86 ****
      print sort
      unInstrumentTree(Node)
!     checkoutput(2403574442)
  
  if __name__ == '__main__':
--- 82,86 ----
      print sort
      unInstrumentTree(Node)
!     checkoutput(2713552348)
  
  if __name__ == '__main__':

Index: out0
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out0,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** out0	31 Dec 2003 21:53:11 -0000	1.6
--- out0	1 Jan 2004 05:35:19 -0000	1.7
***************
*** 7011,9175 ****
    return False
   return
!  Node.geneval("{u'strhash': <Functi...erator object at 0>}, {}")
   return <generator object at 0>
!  Assign.eval("{u'strhash': <Functi...erator object at 0>}, {}")
!   Exprs.eval("{u'strhash': <Functi...erator object at 0>}, {}")
!    Literal.eval("{u'strhash': <Functi...erator object at 0>}, {}")
     return 2
!    Literal.eval("{u'strhash': <Functi...erator object at 0>}, {}")
     return 4
[...4301 lines suppressed...]
!   Exprs.assign("(3L, 3L), {u'pi': <Generator o...nction object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
!    Name.assign("3L, {u'pi': <Generator o...nction object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
     return
!    Name.assign("3L, {u'pi': <Generator o...nction object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
     return
    return
   return
!  While.geneval("{u'pi': <Generator o...nction object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
   return <generator object at 0>
!  Binop.eval("{u'pi': <Generator o...nction object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
!   Name.eval("{u'pi': <Generator o...nction object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
    return 3L
!   Name.eval("{u'pi': <Generator o...nction object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
    return 3L
   return True
!  Yield.geneval("{u'pi': <Generator o...nction object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
   return <generator object at 0>
!  Name.eval("{u'pi': <Generator o...nction object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
   return 3L
  3141592653

Index: out4
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out4,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** out4	31 Dec 2003 21:53:12 -0000	1.4
--- out4	1 Jan 2004 05:35:19 -0000	1.5
***************
*** 37,41 ****
    return False
   return
!  Define.eval("{'heappop': <Functio...nction object at 0>}, {'heappop': <Functio...nction object at 0>}")
    Node.isgenerator('')
    return False
--- 37,41 ----
    return False
   return
!  Define.eval("{'heapify': <Functio...nction object at 0>}, {'heapify': <Functio...nction object at 0>}")
    Node.isgenerator('')
[...7237 lines suppressed...]
      return [9]
     return <built-in method pop of list object at 0>
    return 9
!   Name.assign("9, {'_siftdown': <Funct...nction object at 0>}, {'heap': []}")
    return
   return
!  If.eval("{'_siftdown': <Funct...nction object at 0>}, {'lastelt': 9, 'heap': []}")
!   Name.eval("{'_siftdown': <Funct...nction object at 0>}, {'lastelt': 9, 'heap': []}")
    return []
!   Assign.eval("{'_siftdown': <Funct...nction object at 0>}, {'lastelt': 9, 'heap': []}")
!    Name.eval("{'_siftdown': <Funct...nction object at 0>}, {'lastelt': 9, 'heap': []}")
     return 9
!    Name.assign("9, {'_siftdown': <Funct...nction object at 0>}, {'lastelt': 9, 'heap': []}")
     return
    return
   return
!  Return.eval("{'_siftdown': <Funct...nction object at 0>}, {'lastelt': 9, 'returnitem': 9, 'heap': []}")
!   Name.eval("{'_siftdown': <Funct...nction object at 0>}, {'lastelt': 9, 'returnitem': 9, 'heap': []}")
    return 9
   raise <DoReturn instance at 0>





More information about the Python-checkins mailing list