[Tutor] fast list traversal

wesley chun wescpy at gmail.com
Fri Oct 31 00:55:08 CET 2008


> They seem pretty similar. Here are two tests (code follows). Perhaps I
> could have loaded them differently and it would have made more of a
> difference. In this case I just made a list and populated the sets
> from it.
>
> Results for 9999999 iterations:
>        Set:
>                Load: 1.24 seconds
>                Process: 4.43 seconds
>
>        Frozenset:
>                Load: 0.96 seconds
>                Process: 4.09 seconds
>
> Comparison:
>        Set loads 1.30 times the speed of a frozenset.
>        Set processes loads 1.08 times the speed of a frozenset.


wow, is it me, or do both set types seem to have *significantly*
faster load times... process times seems to be in the middle. very
ineresting... thx for running it through!

-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
    http://corepython.com

"Python Web Development with Django", Addison Wesley, (c) 2008
http://withdjango.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com


More information about the Tutor mailing list