Python isn't necessarily slow

Peter Hansen peter at engcorp.com
Mon Mar 4 08:59:45 EST 2002


Siegfried Gonzi wrote:
> [I am not sure how to use the profiler in Python; the profiler
> reports 70sec. This is clearly wrong.]

"Wrong" is relative.  Actually, the *profiler* is relative too.
Don't use it for absolute measurements -- use it to compare areas
of code to find the worst culprit.  Probably you're looking at
the effect of not having a Heisenberg compensator in the 
interpreter :-) because the profiler itself will slow down the
execution of course.

As far as absolute time goes, don't use a tool for that.  Just
run the program and ask yourself "was that fast enough for my
needs?".  If your program runs once a day, even 70 sec is fast
enough.  If you run it every thirty seconds, I guess you have
to go with the Clean version after all. :-)

-Peter



More information about the Python-list mailing list