Guido's regrets: filter and map

Tracy Ruggles tracy at reinventnow.com
Tue Nov 26 09:12:07 EST 2002


MacOS X 10.2.2 -- 867Mhz G4 -- Python 2.2.1

[~/Desktop] tsr% python2.2 aa.py 
for loop took 5.00
list comprehension took 6.41
map took 4.02
[~/Desktop] tsr% python2.2 aa.py
for loop took 4.97
list comprehension took 6.42
map took 4.08
[~/Desktop] tsr% python2.2 -O aa.py
for loop took 4.91
list comprehension took 6.35
map took 4.03
[~/Desktop] tsr% python2.2 -O aa.py
for loop took 4.91
list comprehension took 6.33
map took 3.99

Alex Martelli <aleax at aleax.it> wrote in message news:<QinE9.70119$Yw.3331389 at news2.tin.it>...
> Dennis Lee Bieber wrote:
>    ...
> >         Well, to add some more embers... Two runs under Mandrake 8.2, on a
> > 733MHz P-III with RDRAM (Dell XPS B733r), Python 2.2, using the program
> > listed above.
> > 
    [ ... ]
> > [wulfraed at beastie wulfraed]$ python t.py
> > for loop took 7.61 to make a list of 500000 items
> > list comprehension took 7.31 to make a list of 500000 items
> > map took 6.85 to make a list of 500000 items
> 
> And Mandrake 9.0, 1.33 GHz AMD Athlon, and 266-MHz DDR :
> 
> [alex at lancelot alex]$ python2.2 -O aa.py
> for loop took 2.87 to make a list of 500000 items
> list comprehension took 2.75 to make a list of 500000 items
    [ ... ]
> map took 2.47 to make a list of 500000 items
> [alex at lancelot alex]$ python2.3 -O aa.py
> for loop took 2.33 to make a list of 500000 items
> list comprehension took 2.32 to make a list of 500000 items
> map took 1.61 to make a list of 500000 items



More information about the Python-list mailing list