Skip to content

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

License

Notifications You must be signed in to change notification settings

josephwecker/libhhash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 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 methdod of
linear probing.


IMPLEMENTATIOON NOTES

The neighbourhood of baskets is circular going back after the last
element to the first using modulo arithmetics. Whereever 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
logartihm 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. The provided mkfile is written for Plan 9 mk which is
provided on other platforms by the Plan 9 Ports [2]. If Plan9port is
available to get the library compiled and, optionally installed, use
'mk [install]'.

The environment variables needed to install are in mkconfig, which is
a Plan 9 RC script. The variable BASE referes to the base directory of
this library. If you use BASH shell, you can use mkconfig.sh instead.


TESTING

Unit tests can be found from the directory ut. The associated mkfile
is contained within as is the documentation of them. The header
9unit.h is our entire unit test library and is included here. The
script check runs executables and prints either "pass" or "FAIL" with
obvious semantics depending on the return value of the executed test.


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