[issue6931] dreadful performance in difflib: ndiff and HtmlDiff
Jack Diederich
report at bugs.python.org
Tue Feb 23 01:18:36 CET 2010
Jack Diederich <jackdied at gmail.com> added the comment:
Here is a profile run of the 200 line case, run on the 3.x trunk, and with all the trivial functions removed. quick_ratio and __contains__ dominate the time. The process was CPU bound, memory usage stayed low.
17083154 function calls (17066360 primitive calls) in 248.779 CPU seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
10660375 70.516 0.000 70.516 0.000 :0(__contains__)
114482 1.048 0.000 1.048 0.000 :0(append)
4434776 29.254 0.000 29.254 0.000 :0(get)
685047/685042 4.400 0.000 4.400 0.000 :0(len)
197349 1.512 0.000 1.512 0.000 :0(min)
197133 1.452 0.000 1.452 0.000 difflib.py:228(set_seq1)
2500 1.632 0.001 3.092 0.001 difflib.py:299(__chain_b)
1082 2.520 0.002 4.768 0.004 difflib.py:350(find_longest_match)
339143 2.580 0.000 2.580 0.000 difflib.py:40(_calculate_ratio)
141727 120.599 0.001 220.970 0.002 difflib.py:661(quick_ratio)
196736 6.956 0.000 12.549 0.000 difflib.py:690(real_quick_ratio)
8974/794 5.052 0.001 248.431 0.313 difflib.py:945(_fancy_replace)
----------
nosy: +jackdied
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6931>
_______________________________________
More information about the Python-bugs-list
mailing list