Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 May 2008 22:43:50 +0200
From:      Roman Divacky <rdivacky@freebsd.org>
To:        hackers@freebsd.org
Subject:   hashinit versus phashinit
Message-ID:  <20080505204350.GA45321@freebsd.org>

next in thread | raw e-mail | index | archive | help
hi

when we want to use a hash table in kernel we call "hashinit" which
initializes a hash table with power-of-2 size. There's also "phashinit"
that creates hash table of size that is a prime number. This was
added in 1995 by davidg@ but it is not used anywhere in the kernel.

phk@ commited rev. 1.30 of vfs_cache.c replacing phashinit with hashinit
stating that it's better because it replaces a division with logical and.
is this reason still valid today? (the commit was done almost 11 years ago)

is there still any reason why not use the phashinit instead of hashinit?
I believe using prime-sized hash table might have positive performance
impact...

do you have comments?

roman



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080505204350.GA45321>