performance question

Paul Rudin Paul_Rudin at scientia.com
Wed Feb 12 10:40:53 EST 2003


I'm writing a couple of scripts and, more out of curiosity that
anything else, I thought I'd run the profiler over the code, to see if
I could identify any worthwhile speedups.

I've noticed some behaviour that I don't really understand. Repeated
invocations of the same bit of code under the profiler in the same
interpreter instance take longer and longer to execute. Kill the
interpreter and do each run in a new session and they take roughly the
amount of time.

At first I thought they maybe something to do with garbage collection
could explain this. But I used gc.set_threshold(0) and an explicit
gc.collect() before each run and I still see the same thing. 

Each invocation works on the same data - a rather long string bound to
a global variable. But there's no state in my code that could account
for the difference (or at least not that I'm aware of). The profiler
reports exactly the same number of calls of each function for each
invocation.

Can anyone suggest why I'm seeing this behaviour?

-- 
Hold the MAYO & pass the COSMIC AWARENESS...




More information about the Python-list mailing list