summaryrefslogtreecommitdiff
path: root/sphinx/pycode
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-12-30 01:32:01 +0100
committerGeorg Brandl <georg@python.org>2008-12-30 01:32:01 +0100
commitbc4c6b9214603c8a04b965eae7ddebaa61727530 (patch)
tree96f867575652284bb6939ecfd779ca780c9c6e67 /sphinx/pycode
parent484625cc327f4fab73313f785b9aaeb94080e5be (diff)
downloadsphinx-bc4c6b9214603c8a04b965eae7ddebaa61727530.tar.gz
Move benchmark into __main__ block.
Diffstat (limited to 'sphinx/pycode')
-rw-r--r--sphinx/pycode/__init__.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py
index dd32d470..373d4a48 100644
--- a/sphinx/pycode/__init__.py
+++ b/sphinx/pycode/__init__.py
@@ -160,12 +160,12 @@ class ModuleAnalyzer(object):
attr_visitor.visit(self.tree)
return attr_visitor.collected
-
-x0 = time.time()
-ma = ModuleAnalyzer.for_module('sphinx.builders.html')
-x1 = time.time()
-for name, doc in ma.find_attrs():
- print '>>', name
- print doc
-x2 = time.time()
-print "parsing %.4f, finding %.4f" % (x1-x0, x2-x1)
+if __name__ == '__main__':
+ x0 = time.time()
+ ma = ModuleAnalyzer.for_file('sphinx/builders/html.py', 'sphinx.builders.html')
+ x1 = time.time()
+ for name, doc in ma.find_attrs():
+ print '>>', name
+ print doc
+ x2 = time.time()
+ print "parsing %.4f, finding %.4f" % (x1-x0, x2-x1)