Commit 3ddfe2e7 authored by Guido van Rossum's avatar Guido van Rossum

- Use a cStringIO instance instead of a dumy file.

- Rearrange pickle imports.
parent c3a2e1fb
...@@ -90,7 +90,8 @@ Helper program to time TALVisitor and other DOM tree operations. ...@@ -90,7 +90,8 @@ Helper program to time TALVisitor and other DOM tree operations.
import sys import sys
import time import time
import getopt import getopt
import cPickle from cPickle import dumps, loads
from cStringIO import StringIO
from driver import parsefile, copytree, talizetree, printtree, FILE from driver import parsefile, copytree, talizetree, printtree, FILE
from driver import compiletree, interpretit from driver import compiletree, interpretit
...@@ -110,13 +111,14 @@ def main(): ...@@ -110,13 +111,14 @@ def main():
file = args[0] file = args[0]
else: else:
file = FILE file = FILE
dummyfile = StringIO()
doc = timefunc(count, parsefile, file) doc = timefunc(count, parsefile, file)
doc = timefunc(count, copytree, doc) doc = timefunc(count, copytree, doc)
doc2 = timefunc(count, talizetree, doc) doc2 = timefunc(count, talizetree, doc)
timefunc(count, printtree, doc, open("/dev/null", "w")) timefunc(count, printtree, doc, dummyfile)
timefunc(count, macroIndexer, doc) timefunc(count, macroIndexer, doc)
it = timefunc(count, compiletree, doc) it = timefunc(count, compiletree, doc)
timefunc(count, interpretit, it, None, open("/dev/null", "w")) timefunc(count, interpretit, it, None, dummyfile)
s = timefunc(count, pickletree, doc) s = timefunc(count, pickletree, doc)
timefunc(count, unpickletree, s) timefunc(count, unpickletree, s)
...@@ -132,10 +134,10 @@ def timefunc(count, func, *args): ...@@ -132,10 +134,10 @@ def timefunc(count, func, *args):
return result return result
def pickletree(doc): def pickletree(doc):
return cPickle.dumps(doc) return dumps(doc)
def unpickletree(s): def unpickletree(s):
return cPickle.loads(s) return loads(s)
if __name__ == "__main__": if __name__ == "__main__":
main() main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment