Created
January 4, 2012 02:27
-
-
Save sirpengi/1558151 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(py27)[shuchen@archy Downloads]$ cat test.py | |
from docutils.core import publish_string | |
import pstats, cProfile | |
fn = 'foo.rst' | |
profile_fn = fn + '.prof' | |
with open(fn) as fh: | |
data = fh.read() | |
def gogogo(): | |
publish_string(data, writer_name='html') | |
cProfile.runctx("gogogo()", globals(), locals(), profile_fn) | |
s = pstats.Stats(profile_fn) | |
s.strip_dirs().sort_stats("time").print_stats() | |
(py27)[shuchen@archy Downloads]$ python test.py | |
Wed Jan 4 10:25:37 2012 foo.rst.prof | |
52993432 function calls (51421205 primitive calls) in 164.208 seconds | |
Ordered by: internal time | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
563068 23.004 0.000 30.526 0.000 statemachine.py:1146(__getitem__) | |
21408 20.923 0.001 20.923 0.001 {method 'index' of 'list' objects} | |
21532 20.912 0.001 20.912 0.001 {method 'remove' of 'list' objects} | |
21408 13.919 0.001 83.071 0.004 states.py:2305(explicit_list) | |
707790 12.273 0.000 32.137 0.000 statemachine.py:727(make_transitions) | |
4057996 7.517 0.000 19.249 0.000 statemachine.py:694(make_transition) | |
125977 7.129 0.000 7.299 0.000 statemachine.py:1091(__init__) | |
3536811 4.346 0.000 5.469 0.000 re.py:228(_compile) | |
4412002 3.537 0.000 3.537 0.000 {hasattr} | |
21408 3.053 0.000 47.984 0.002 misc.py:44(apply) | |
707790 3.006 0.000 3.590 0.000 statemachine.py:650(add_transitions) | |
88730 2.840 0.000 2.840 0.000 {range} | |
1194490/10 1.958 0.000 2.552 0.255 nodes.py:189(_fast_traverse) | |
3515403 1.732 0.000 7.128 0.000 re.py:188(compile) | |
353895 1.501 0.000 38.650 0.000 statemachine.py:974(add_initial_transitions) | |
2931 1.468 0.001 12.061 0.004 states.py:1532(line_block) | |
353895 1.339 0.000 39.988 0.000 statemachine.py:596(__init__) | |
4330374 1.302 0.000 1.302 0.000 {getattr} | |
353895 1.254 0.000 30.643 0.000 statemachine.py:643(add_initial_transitions) | |
82897 1.243 0.000 2.623 0.000 __init__.py:374(starttag) | |
2538732 1.159 0.000 1.159 0.000 {isinstance} | |
353895 1.138 0.000 42.176 0.000 states.py:212(__init__) | |
109969 1.077 0.000 1.443 0.000 nodes.py:433(__init__) | |
3703533 1.066 0.000 1.066 0.000 {method 'get' of 'dict' objects} | |
353895 1.049 0.000 41.038 0.000 statemachine.py:958(__init__) | |
110427/73014 0.886 0.000 104.720 0.001 statemachine.py:422(check_line) | |
1105419 0.855 0.000 0.855 0.000 {method 'match' of '_sre.SRE_Pattern' objects} | |
5014936 0.793 0.000 0.793 0.000 {method 'append' of 'list' objects} | |
1061721 0.752 0.000 0.752 0.000 {method 'update' of 'dict' objects} | |
483808 0.715 0.000 0.853 0.000 {method 'join' of 'str' objects} | |
353895 0.695 0.000 42.871 0.000 statemachine.py:466(add_state) | |
36552 0.681 0.000 3.261 0.000 __init__.py:1101(visit_literal) | |
82897/1 0.681 0.000 6.238 6.238 nodes.py:146(walkabout) | |
353895 0.659 0.000 0.752 0.000 states.py:217(runtime_init) | |
273242 0.634 0.000 0.634 0.000 {method 'translate' of 'unicode' objects} | |
23593/1 0.626 0.000 105.580 105.580 statemachine.py:182(run) | |
202346 0.625 0.000 5.650 0.000 nodes.py:1593(dispatch_visit) | |
230426 0.622 0.000 1.231 0.000 __init__.py:336(encode) | |
21408 0.617 0.000 1.469 0.000 states.py:2102(parse_directive_block) | |
242042 0.588 0.000 0.588 0.000 {method 'search' of '_sre.SRE_Pattern' objects} | |
195772 0.499 0.000 0.790 0.000 statemachine.py:510(notify_observers) | |
190945 0.480 0.000 0.888 0.000 nodes.py:623(extend) | |
119449/1 0.439 0.000 0.870 0.870 nodes.py:100(walk) | |
38160 0.437 0.000 0.928 0.000 statemachine.py:1370(get_indented) | |
38160 0.376 0.000 2.637 0.000 states.py:483(parse) | |
***********snip | |
(py27)[shuchen@archy Downloads]$ cat test2.py | |
from docutils.core import publish_string | |
import pstats, cProfile | |
fn = 'foo2.rst' | |
profile_fn = fn + '.prof' | |
with open(fn) as fh: | |
data = fh.read() | |
def gogogo(): | |
publish_string(data, writer_name='html') | |
cProfile.runctx("gogogo()", globals(), locals(), profile_fn) | |
s = pstats.Stats(profile_fn) | |
s.strip_dirs().sort_stats("time").print_stats() | |
(py27)[shuchen@archy Downloads]$ python test2.py | |
Wed Jan 4 10:36:36 2012 foo2.rst.prof | |
105901003 function calls (102758576 primitive calls) in 566.261 seconds | |
Ordered by: internal time | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
1126135 109.912 0.000 142.351 0.000 statemachine.py:1146(__getitem__) | |
42940 80.835 0.002 80.835 0.002 {method 'remove' of 'list' objects} | |
42816 80.725 0.002 80.725 0.002 {method 'index' of 'list' objects} | |
42816 68.160 0.002 295.431 0.007 states.py:2305(explicit_list) | |
1415550 34.846 0.000 75.498 0.000 statemachine.py:727(make_transitions) | |
251953 31.567 0.000 31.975 0.000 statemachine.py:1091(__init__) | |
8115820 15.020 0.000 39.389 0.000 statemachine.py:694(make_transition) | |
177293 14.281 0.000 14.281 0.000 {range} | |
42816 13.783 0.000 190.365 0.004 misc.py:44(apply) | |
7073427 9.351 0.000 11.524 0.000 re.py:228(_compile) | |
1415550 8.778 0.000 9.959 0.000 statemachine.py:650(add_transitions) | |
8823706 7.314 0.000 7.314 0.000 {hasattr} | |
5862 6.985 0.001 38.247 0.007 states.py:1532(line_block) | |
2388970/10 3.795 0.000 4.961 0.496 nodes.py:189(_fast_traverse) | |
707775 3.530 0.000 75.363 0.000 statemachine.py:643(add_initial_transitions) | |
707775 3.513 0.000 95.797 0.000 statemachine.py:596(__init__) | |
7030611 3.483 0.000 14.812 0.000 re.py:188(compile) | |
707775 3.277 0.000 101.204 0.000 states.py:212(__init__) | |
707775 2.970 0.000 92.284 0.000 statemachine.py:974(add_initial_transitions) | |
8660478 2.629 0.000 2.629 0.000 {getattr} | |
219937 2.574 0.000 3.379 0.000 nodes.py:433(__init__) | |
5074806 2.466 0.000 2.466 0.000 {isinstance} | |
165793 2.400 0.000 5.124 0.000 __init__.py:374(starttag) | |
7405941 2.157 0.000 2.157 0.000 {method 'get' of 'dict' objects} | |
707775 2.130 0.000 97.927 0.000 statemachine.py:958(__init__) | |
2210838 1.884 0.000 1.884 0.000 {method 'match' of '_sre.SRE_Pattern' objects} | |
220854/146028 1.801 0.000 353.218 0.002 statemachine.py:422(check_line) | |
10020733 1.625 0.000 1.625 0.000 {method 'append' of 'list' objects} | |
2123361 1.509 0.000 1.509 0.000 {method 'update' of 'dict' objects} | |
967552 1.435 0.000 1.722 0.000 {method 'join' of 'str' objects} | |
707775 1.418 0.000 102.622 0.000 statemachine.py:466(add_state) | |
73104 1.322 0.000 6.383 0.000 __init__.py:1101(visit_literal) | |
165793/1 1.306 0.000 12.138 12.138 nodes.py:146(walkabout) | |
707775 1.298 0.000 1.488 0.000 states.py:217(runtime_init) | |
546482 1.273 0.000 1.273 0.000 {method 'translate' of 'unicode' objects} | |
47185/1 1.267 0.000 354.948 354.948 statemachine.py:182(run) | |
42816 1.245 0.000 2.984 0.000 states.py:2102(parse_directive_block) | |
460850 1.226 0.000 2.435 0.000 __init__.py:336(encode) | |
404690 1.203 0.000 11.016 0.000 nodes.py:1593(dispatch_visit) | |
484082 1.190 0.000 1.190 0.000 {method 'search' of '_sre.SRE_Pattern' objects} | |
391543 1.026 0.000 1.641 0.000 statemachine.py:510(notify_observers) | |
76320 0.936 0.000 2.034 0.000 statemachine.py:1370(get_indented) | |
238897/1 0.837 0.000 1.669 1.669 nodes.py:100(walk) | |
76320 0.788 0.000 6.007 0.000 states.py:483(parse) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment