list IndexError

Nick Coghlan ncoghlan at iinet.net.au
Thu Dec 23 03:49:30 EST 2004


Peter Otten wrote:
> I do not think it measures what you think it measures.

Ah, good point. . . so we were actually measuring how long it takes to make zero 
replacements on the modified list, which explains the downward trend of the 
timings (as the modified list gets shorter).

Adding the list copy (using lst[:] in the call to the remove() method) gives me 
these numbers:

.1%  lc: 2410 usec  try:   617 usec
10%  lc: 2020 usec  try:  7340 usec
50%  lc: 1780 usec  try: 34300 usec
90%  lc: 1450 usec  try: 61000 usec

Right, that's *far* more like the numbers I was expecting :)

And now they demonstrate what they were meant to demonstrate - that there's a 
reason filtration is the recommended approach!

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list