print statements and profiling a function slowed performance
CM
cmpython at gmail.com
Thu Jun 26 14:44:29 EDT 2014
Huh. I learned two new Python facts this week:
1. print statements were slowing down my code enough to
really notice a particular transition. It went from about
2-3 seconds to a bit under 1 second. What at first seemed
unresponsive now seems almost snappy. The only difference
was removing a lot of print statements I had used for
debugging (Python 2.5, on a single core 1.97 Ghz machine).
2. Merely having a cPython decorator for profiling a
function significantly slowed down performance...again,
from a about 2 seconds to just under a second (~1 second
doesn't seem much but these sorts of delays do affect
user experience). There is something ironic or
Heisenbergian about that.
More information about the Python-list
mailing list