Performance problem with filtering

Sean 'Shaleh' Perry shalehperry at attbi.com
Thu Mar 14 02:34:51 EST 2002


> 
> I understand how it works logically. I simply thought there might've been
> some tricky C implementation of list comprehensions that improved
> performance.
> 

even if it was coded in hand tuned assembly it would be slower than the
dictionary method because the algorithm is inherently slow.  Every pass of the
for i in list loop must make an entire walk of the other list.  No matter how
fast you make the walking, you still have to walk.  Jog a mile, walk a mile it
is still a mile.

The dictionary version is faster because the key lookup does not have to check
every key.




More information about the Python-list mailing list