[Python-Dev] Counting collisions for the win

Janzert janzert at janzert.com
Mon Jan 23 23:38:47 CET 2012


On 1/23/2012 1:25 PM, Glenn Linderman wrote:
> On 1/23/2012 12:53 AM, Frank Sievertsen wrote:
>>
>> What if we use a second (randomized) hash-function in case there
>> are many collisions in ONE lookup. This hash-function is used only
>> for collision resolution and is not cached.
>
> So this sounds like SafeDict, but putting it under the covers and
> automatically converting from dict to SafeDict after a collision
> threshold has been reached.  Let's call it fallback-dict.
>

If you're going to essentially switch data structures dynamically 
anyway, why not just switch to something that doesn't have n**2 worse 
case performance?

Janzert



More information about the Python-Dev mailing list