Loop performance disappearance

Mikael Johansson mikael.johansson at helsinki.fet
Wed Mar 15 14:43:43 CET 2000

Hello All!

I was just wondering what the reason for the huge performance decrease
in a loop execution when the number of steps exceeds some critical value
is. To give an example:

for i in range(loops):

If loops=500 000 (space added for clarity) the "program" executes in ~2
secs on my machine. But if loops is set to 5 000 000, the execution time
rises to substantially more than tenfold (I terminated it after one
minute). However the CPU-load is quite small, most of the time is spent
disk swapping like crazy!

Any ideas of the reason for this, work-arounds?

Have a nice day,
    Mikael J.
    for email correct domain

More information about the Python-list mailing list