Dicts 5x Faster than Sets

David Wilson dw at botanicus.net
Wed Jun 9 23:07:15 CEST 2004


On Wed, Jun 09, 2004 at 12:24:25PM -0700, Kamilche wrote:

> Hm, I just saw the 'sets' feature, and ran some timings to see if I
> should use it instead of 'dict' sometimes. I discovered it's 4x slower
> in adding, and 6x slower in removing items!

Which version of Python did you test this on? In the upcoming Python
2.4, sets will be significantly faster, so don't discard their use yet,
as they'll be implemented using native code within the year.


David.

-- 
"Science is what we understand well enough to explain to a
computer. Art is everything else we do."
    -- Donald Knuth




More information about the Python-list mailing list