Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
8b558420
Commit
8b558420
authored
Jan 31, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Time how long it takes to pickle/unpickle the tree.
- Don't use a wrapper function around macroIndexer.
parent
bc531604
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
lib/python/TAL/timer.py
lib/python/TAL/timer.py
+10
-4
No files found.
lib/python/TAL/timer.py
View file @
8b558420
...
...
@@ -90,9 +90,11 @@ Helper program to time TALVisitor and other DOM tree operations.
import
sys
import
time
import
getopt
import
cPickle
from
driver
import
parsefile
,
copytree
,
talizetree
,
printtree
,
FILE
from
driver
import
compiletree
,
interpretit
from
TALVisitor
import
macroIndexer
def
main
():
count
=
10
...
...
@@ -112,9 +114,11 @@ def main():
doc
=
timefunc
(
count
,
copytree
,
doc
)
doc2
=
timefunc
(
count
,
talizetree
,
doc
)
timefunc
(
count
,
printtree
,
doc
,
open
(
"/dev/null"
,
"w"
))
timefunc
(
count
,
findmacros
,
doc
)
timefunc
(
count
,
macroIndexer
,
doc
)
it
=
timefunc
(
count
,
compiletree
,
doc
)
timefunc
(
count
,
interpretit
,
it
,
None
,
open
(
"/dev/null"
,
"w"
))
s
=
timefunc
(
count
,
pickletree
,
doc
)
timefunc
(
count
,
unpickletree
,
s
)
def
timefunc
(
count
,
func
,
*
args
):
sys
.
stderr
.
write
(
"%-14s: "
%
func
.
__name__
)
...
...
@@ -127,9 +131,11 @@ def timefunc(count, func, *args):
%
((
t1
-
t0
),
count
,
1000
*
(
t1
-
t0
)
/
count
))
return
result
def
findmacros
(
doc
):
from
TALVisitor
import
macroIndexer
return
macroIndexer
(
doc
)
def
pickletree
(
doc
):
return
cPickle
.
dumps
(
doc
)
def
unpickletree
(
s
):
return
cPickle
.
loads
(
s
)
if
__name__
==
"__main__"
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment