[Zope3-checkins] Re: SVN: Zope3/trunk/src/zope/tal/ The lists has been changed to dicts for faster membership testing

Fred Drake fdrake at gmail.com
Fri Apr 22 11:00:02 EDT 2005


On 4/22/05, Dmitry Vasiliev <lists at hlabs.spb.ru> wrote:
> ...or if you repeat the operation for many times.

Indeed!

> List: [3.8474152441162213, 3.8472666218751264, 3.8494990285078119]
> Dict: [1.783690664595639, 1.7893994907173969, 1.8036929274530724]
...
> I think it's always better use a mapping if you need membership testing
> operation if possible, since you will have practically constant lookup time.

It might be interesting to try the C implementations of sets in Python
2.4 as well.  I expect it's similar to the dict, but the frozenset may
offer some benefits (not sure).


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>
Zope Corporation


More information about the Zope3-Checkins mailing list