stupid/style/list question

Duncan Booth duncan.booth at invalid.invalid
Wed Jan 9 10:53:49 EST 2008


bearophileHUGS at lycos.com wrote:

> Duncan Booth:
>> I tried to measure this with timeit, and it looks like the 'del' is
>> actually quite a bit faster (which I find suprising).
> 
> Yes, it was usually faster in my benchmarks too. Something similar is
> true for dicts too. I think such timings are influenced a lot by the
> garbage collector.
> 
That may come into it, but I made the obvious change I mentioned (to avoid 
dereferncing a pointer every time through the loop) and got about an 8% 
speed-up on my test. I don't think that explains all of the speed 
difference though, so the garbage collector may come into it too: I'll see 
if I can do some more experimentation before submitting a patch.




More information about the Python-list mailing list