performance degradation when looping through lists

bruno at modulix onurb at xiludom.gro
Fri Apr 7 08:42:06 EDT 2006


Joachim Worringen wrote:
> I need to process large lists (in my real application, this is to parse
> the content of a file). 

Then you probably want to use generators instead of lists. The problem
with large lists is that they eat a lot of memory - which can result in
swapping .

> I noticed that the performance to access the
> individual list elements degrades over runtime.

I leave this point to gurus, but it may have to do with swapping. Also,
this is not real-time, so variations may have to do with your OS tasks
scheduler.

My 2 cents
-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list