trafficserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Sorber <p...@sorber.net>
Subject Re: RamCacheCLFUS
Date Mon, 18 Feb 2013 21:59:48 GMT
On Mon, Feb 18, 2013 at 4:41 PM, Tomasz Kuzemko <tomasz@kuzemko.net> wrote:

> Did not look at the code, but seems like it is part of some general hash
> table implementation.
>
>
It is for a hash table AFAICT.


> Good explanation why these are primes:
>
> http://stackoverflow.com/**questions/1145217/why-should-**
> hash-functions-use-a-prime-**number-modulus<http://stackoverflow.com/questions/1145217/why-should-hash-functions-use-a-prime-number-modulus>
>
>
Ah, that is very interesting and makes good sense. I will add a comment.

Thanks.


> Best regards,
> Tomasz Kuzemko
> tomasz@kuzemko.net
>
> W dniu 18.02.2013 20:50, Phil Sorber pisze:
>
>  In looking through RamCacheCLFUS I came upon this:
>>
>> static const int bucket_sizes[] = {
>>    127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071,
>> 262139,
>>    524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393,
>> 67108859,
>>    134217689, 268435399, 536870909, 1073741789, 2147483647
>> };
>>
>> Looking through git blame and JIRA it looks like it was part of the
>> initial
>> patch for CLFUS. In talking with James in IRC he pointed out that it looks
>> like the largest prime less than a power of 2. This seems like a very
>> deliberate choice, but I can't figure out why and there are no docs
>> explaining. Can someone, perhaps John, shed some light on it?
>>
>> Thanks.
>>
>>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message