[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-idutils] Re: using %= in hash_find_slot, and optimized STRING_H
From: |
Jim Meyering |
Subject: |
Re: [bug-idutils] Re: using %= in hash_find_slot, and optimized STRING_HASH_1 |
Date: |
Wed, 15 Dec 2010 10:27:52 +0100 |
Sami Farin wrote:
> jhash seems to be okay with idutils, at least on my CPU. It's faster than
> the hack in my previous post, due to fewer collisions. It could cache result
> of strlen's somewhere, but that might be micro-optimizing.
> Note that I have not thought about portability or coding style of this patch,
> but it works for me.
>
> I also took the hash_ptr from Linux 2.6.36.
Thanks for working on idutils.
Before we can use contributions by you, you'll have to
fill out some paperwork, assuming any school/employer
is ok with that. Here's the procedure I wrote up for coreutils.
For idutils it's the same:
http://git.savannah.gnu.org/cgit/coreutils.git/tree/HACKING#n429
There might be copyright complications with adding jhash (unless
it's GPLv3) or code from the kernel. If you're inclined, I'd like to
see if you get similar gains by switching to the use of the hash_pjw
function from gnulib (lib/hash-pjw.c). Using that would require changing
hash_init to take hashing functions with different signatures: this new
hash function has to know the size of the hash table. But that would
be a good thing regardless, since it permits better use of the limited
number of bits in each key.