[Python-checkins] python/nondist/sandbox/parrotbench b.py, 1.2, 1.3 b0.py, 1.4, 1.5 out0, 1.3, 1.4 out4, 1.1, 1.2

gvanrossum at users.sourceforge.net gvanrossum at users.sourceforge.net
Tue Dec 30 21:04:26 EST 2003


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

Modified Files:
	b.py b0.py out0 out4 
Log Message:
Reduce output volume somewhat.

Index: b.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** b.py	31 Dec 2003 01:33:07 -0000	1.2
--- b.py	31 Dec 2003 02:04:20 -0000	1.3
***************
*** 1,3 ****
! import b0
  import b1
  import b2
--- 1,3 ----
! import b0; b0.main()
  import b1
  import b2

Index: b0.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b0.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** b0.py	31 Dec 2003 01:33:07 -0000	1.4
--- b0.py	31 Dec 2003 02:04:20 -0000	1.5
***************
*** 792,808 ****
          self.name = name
          self.obj = obj
!     def __call__(self, *args, **kwds):
          global indent
          oldindent = indent
          try:
              indent = indent + " "
!             if kwds:
!                 writeln(indent + "%s(*%r, **%r)" % (self.name, args, kwds))
!             elif len(args) == 1:
!                 writeln(indent + "%s(%r)" % (self.name, args[0]))
!             else:
!                 writeln(indent + "%s%r" % (self.name, args))
              try:
!                 result = self.obj(*args, **kwds)
              except Exception, exc:
                  writeln(indent + "raise %r" % (exc,))
--- 792,809 ----
          self.name = name
          self.obj = obj
!     def __call__(self, *args):
          global indent
          oldindent = indent
          try:
              indent = indent + " "
!             argreprs = map(repr, args)
!             for i, s in enumerate(argreprs):
!                 s = s.replace('<b0.', '<__main__.')
!                 if len(s) >= 45:
!                     s = s[:20] + "..." + s[-20:]
!                 argreprs[i] = s
!             writeln(indent + "%s(%r)" % (self.name, ", ".join(argreprs)))
              try:
!                 result = self.obj(*args)
              except Exception, exc:
                  writeln(indent + "raise %r" % (exc,))
***************
*** 827,904 ****
          unInstrumentTree(cls)
  
! s = Scanner(getcFromString(sample).next)
! it = Clone(s.tokenize())
! it2 = Clone(it)
! L = []
! for pair in it:
!     L.append(pair)
! L2 = list(it2)
! check(L, L2)
  
! scanner = Scanner(getcFromString(sample).next).tokenize()
! parser = Parser(scanner)
! root = parser.parse()
  
! scanner = Scanner(getcFromString(sample).next).tokenize()
! parser = Parser(scanner)
! instrumentClass(Parser)
! root = parser.parse()
  
! checkoutput(1365277872)
  
! env = {}
! eval(root, env, env)
! g = env['pi']()
! for i in range(1000):
!     write(g.next())
! writeln('')
! strhash = env['strhash']
  
! for x in '', 'x', 'abc', 'abc'*100:
!     check(strhash(x), myhash(x))
  
! strhash = myhash
! checkoutput(3960406533)
  
! it = Clone(getcFromString(unicode(sample, "utf8")))
! it2 = Clone(it)
! scanner = Scanner(it.next).tokenize()
! parser = Parser(scanner)
! root = parser.parse()
! checkoutput(2293472643)
! env = {}
! eval(root, env, env)
! g = env['pi']()
! for i in range(1000):
!     write(g.next())
! writeln()
! checkoutput(3960406533)
  
! instrumentTree(Node)
! scanner = Clone(Scanner(it2.next).tokenize())
! scanner2 = Clone(scanner)
! parser = Parser(scanner)
! root = parser.parse()
! checkoutput(111416090)
! env = {}
! eval(root, env, env)
! g = env['pi']()
! digits = []
! for i in range(10):
!     digits.append(g.next())
! checkoutput(1793452098)
! print "".join(map(str, digits))
  
! unInstrumentTree(Node)
! unInstrumentClass(Parser)
! parser = Parser(scanner2)
! root = parser.parse()
! checkoutput(0)
! env = {}
! eval(root, env, env)
! g = env['pi']()
! digits = []
! for i in range(10):
!     digits.append(g.next())
! print "".join(map(str, digits))
! out2 = output.getvalue()
--- 828,909 ----
          unInstrumentTree(cls)
  
! def main():
!     s = Scanner(getcFromString(sample).next)
!     it = Clone(s.tokenize())
!     it2 = Clone(it)
!     L = []
!     for pair in it:
!         L.append(pair)
!     L2 = list(it2)
!     check(L, L2)
  
!     scanner = Scanner(getcFromString(sample).next).tokenize()
!     parser = Parser(scanner)
!     root = parser.parse()
  
!     scanner = Scanner(getcFromString(sample).next).tokenize()
!     parser = Parser(scanner)
!     instrumentClass(Parser)
!     root = parser.parse()
  
!     checkoutput(1413352820)
  
!     env = {}
!     eval(root, env, env)
!     g = env['pi']()
!     for i in range(1000):
!         write(g.next())
!     writeln('')
!     strhash = env['strhash']
  
!     for x in '', 'x', 'abc', 'abc'*100:
!         check(strhash(x), myhash(x))
  
!     strhash = myhash
!     checkoutput(3960406533)
  
!     it = Clone(getcFromString(unicode(sample, "utf8")))
!     it2 = Clone(it)
!     scanner = Scanner(it.next).tokenize()
!     parser = Parser(scanner)
!     root = parser.parse()
!     checkoutput(1308798191)
!     env = {}
!     eval(root, env, env)
!     g = env['pi']()
!     for i in range(1000):
!         write(g.next())
!     writeln()
!     checkoutput(3960406533)
  
!     instrumentTree(Node)
!     scanner = Clone(Scanner(it2.next).tokenize())
!     scanner2 = Clone(scanner)
!     parser = Parser(scanner)
!     root = parser.parse()
!     checkoutput(2037684980)
!     env = {}
!     eval(root, env, env)
!     g = env['pi']()
!     digits = []
!     for i in range(10):
!         digits.append(g.next())
!     checkoutput(4201300315)
!     print "".join(map(str, digits))
  
!     unInstrumentTree(Node)
!     unInstrumentClass(Parser)
!     parser = Parser(scanner2)
!     root = parser.parse()
!     checkoutput(0)
!     env = {}
!     eval(root, env, env)
!     g = env['pi']()
!     digits = []
!     for i in range(10):
!         digits.append(g.next())
!     print "".join(map(str, digits))
!     out2 = output.getvalue()
! 
! if __name__ == '__main__':
!     main()

Index: out0
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out0,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** out0	31 Dec 2003 01:33:07 -0000	1.3
--- out0	31 Dec 2003 02:04:20 -0000	1.4
***************
*** 1,42 ****
!  Parser.parse()
!   Parser.parse_stmt()
!    Parser.parse_def()
!     Parser.expect(NAME, 'def')
!      Parser.nexttoken()
       return (NAME, 'pi')
      return 'def'
!     Parser.expect(NAME)
!      Parser.nexttoken()
       return (OPERATOR, '(')
[...18271 lines suppressed...]
!   Exprs.assign("(3L, 3L), {u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
!    Name.assign("3L, {u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
     return
!    Name.assign("3L, {u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
     return
    return
   return
!  While.geneval("{u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
   return <generator object at 0>
!  Binop.eval("{u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
!   Name.eval("{u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
    return 3L
!   Name.eval("{u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
    return 3L
   return True
!  Yield.geneval("{u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}")
   return <generator object at 0>
!  Name.eval("{u'strhash': <__main...ject 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.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** out4	31 Dec 2003 01:33:07 -0000	1.1
--- out4	31 Dec 2003 02:04:20 -0000	1.2
***************
*** 1,3709 ****
-  Define.eval({}, {})
-   Node.isgenerator()
-   return False
-   Node.isgenerator()
-   return False
-  return
-  Define.eval({'heappush': <__main__.Function object at 0>}, {'heappush': <__main__.Function object at 0>})
-   Node.isgenerator()
-   return False
-   If.isgenerator()
[...3680 lines suppressed...]
-   return 9
-   Name.assign(9, {'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'heap': []})
-   return
-  return
-  If.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []})
-   Name.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []})
-   return []
-   Assign.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []})
-    Name.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []})
-    return 9
-    Name.assign(9, {'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []})
-    return
-   return
-  return
-  Return.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'returnitem': 9, 'heap': []})
-   Name.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'returnitem': 9, 'heap': []})
-   return 9
-  raise <__main__.DoReturn instance at 0>
  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
--- 1 ----





More information about the Python-checkins mailing list