There is no "fastest" hash table. There are only relative advantages
and disadvantage.
For example, Larson's Algorithm is extremely helpful for hashes whose
size is not even approximately known at compile time. But it performs
very badly for hashes that rapidly oscillate between very large and
very small sizes. It also requires a power-of-two size, which is a
problem for data with poor distribution of the hash value but fine for
data with a random-like distribution of hash values.
Some algorithms have very fast modifications but compromise search
times. Some have extremely fast search times but are very slow to
modify.
And when you put thread safety into the mix, it comes down to what
kind of operations you see a lot of. For example, the implementation
for read-mostly hash tables will look nothing like one that's balanced
between reads and writes.
And there's always a trade-off between hash values that are easily
computed and hash values that provide very good distribution.
There is no substitute for studying the literature and finding what
best meets your particular requirements. You may need a 'bake off' to
see what hash best solves your particular mix of requirements.
DS
You can try converting this slick C++ implementation into C:
http://groups.google.com/group/lock-free/files
As for a ready made implementation in C, nothing comes to mind right off the
bat. Let me think. BTW, what type of accesses will be hitting the table more
frequently? Mostly reads?
BTW, it will be much faster if you can use a single thread version of
hashtable for general case, and inflate to a thread-safe version for
necessary case.
> "James" <gan...@gmail.com> wrote in message
> news:c6117645-7e11-4f65...@a7g2000yqk.googlegroups.com...
> Following project provides a C implementation of Cliff Click's
> nonblocking hashtable:
> http://code.google.com/p/nbds/
> BTW, it will be much faster if you can use a single thread version of
> hashtable for general case, and inflate to a thread-safe version for
> necessary case.
I forgot about that one:
http://groups.google.com/group/comp.programming.threads/browse_frm/thread/702aedc141b34fa1