DateAndTime hash was: Re: [squeak-dev] true hash

Chris Muller asqueaker at gmail.com
Sat May 12 15:04:16 UTC 2012


DateAndTime>>#hash has been a bane of (poor) performance for many
years, especially for non-UTC dates.  This is so excellent Paul --
thanks a ton!


On Thu, May 10, 2012 at 8:21 AM, Paul DeBruicker <pdebruic at gmail.com> wrote:
> On 05/10/2012 04:21 AM, Nicolas Cellier wrote:
>>
>> Sure, I already changed various Number>>hash and could as well change
>> Point hash to follow recommendations from Andres valloud book hashing
>> in smalltalk...
>>
>> Nicolas
>
>
> DateAndTime>>#hash could be changed to :
>
> hash
>        ^ (jdn hashMultiply bitXor: seconds + offset asSeconds) bitXor: nanos
>
> which is 130x faster than whats currently in the image:
>
> hash
>        ^ self asUTC ticks hash
>
>
> The collision rate on the proposed hash function is 0.04% ( 4 per 10,000 )
>


More information about the Squeak-dev mailing list