DT_GNU_HASH: ~ 50% dynamic linking improvement
djamel anonymous
djam8193ah@hotmail.com
Wed Jul 5 10:07:00 GMT 2006
Hello, first i thank you for your reply.the current hash function is defined
as:
static uint_fast32_t
dl_new_hash (const char *s)
{
uint_fast32_t h = 5381;
for (unsigned char c = *s; c != '\0'; c = *++s)
h = h * 33 + c;
return h & 0xffffffff;
}
with this hash function we have strings of length 1 affect only the first 8
bits, strings of length 2 affect only the first 13 bits... strings of length
4 effect only the first 23 bits.so the full 32 bits of the hash value are
affected beginning with strings of length 6 and above.
for the variant you suggested, i think using the 5 least significant bits
may solve the problem but in this case nbuckets must be odd.another solution
would be to use the bits numbered from 5 to 9.for this solution to be
effective nbuckets must not be a multiple of 64.
best regards.
_________________________________________________________________
MSN Messenger : discutez en direct avec vos amis !
http://www.msn.fr/msger/default.asp
More information about the Libc-alpha
mailing list