Skip to content

coriolanus/libhhash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HOPSCOTCH HASH TABLE IMPLMENTATION

Hash tables are very efficient for key value lookup in both speed and
memory usage. Hopscotch hash tables also provide memory locality and
cache efficiency by using open addressing and a special method of
linear probing.


IMPLEMENTATION NOTES

The neighborhood of baskets is circular going back after the last
element to the first using modulo arithmetic's. Wherever we use a
difference (x-y)%n, in order to keep modulo semantics using unsigned
variables we add n: (n+x-y)%n, which is basically a nop but guarantees
that the result of the subtraction remains positive.

We are using the following GCC builtin function to calculate an integer
logarithm in base 2:

__builtin_clz, count-leading-zeros, returns the number of leading
0-bits in x, starting at the most significant bit position. If x is 0,
the result is undefined.


BUILDING

The code relies, besides the aforementioned builtins, on stdlib.h for the
function malloc. 


TESTING

Unit tests can be found from the directory test. To run them use 'make test'
target. The tests do not print anything but abort if something has not been as
it should.


DOCUMENTATION

A Unix manual page is in the directory man. This also provides the
documentation for the provided functions.


CONTACT

Jani Lahtinen <jani.lahtinen8@gmail.com>


REFERENCES

Herlihy, Maurice and Shavit, Nir and Tzafrir, Moran, Hopscotch
Hashing. DISC '08: Proceedings of the 22nd international symposium on
Distributed Computing. Arcachon, France:
Springer-Verlag. pp. 350--364, 2008.

About

Automatically exported from code.google.com/p/libhhash

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published