Git Product home page Git Product logo

libhhash's Introduction

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 <[email protected]>


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.

libhhash's People

Contributors

coriolanus avatar prango avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

libhhash's Issues

Some randomly generated hashes fail to hhashfind (based on numbers 10millions)

The problem is an inconsistency between the storage of hops in the insertion. 
Occurs when a value has to move ...

I could not fix because they fully understand the operation of insertion.


Search Method:
--------
int hhashfind(HHash *T, uint x)
{
        uint h;
        int i;
        uint y;
        h= x%T->n;
        i = hhashsucc(T,h,0);
        while(i >= 0){
                y = hhashget(T,h,i);
                if(x == y)
                        return 1;
                i = hhashsuccG(T,h,i+1);
        }
        return 0;
}


Original issue reported on code.google.com by [email protected] on 12 Jun 2011 at 11:23

Patch for /hhash.c

If replaced hhashput by hhashput2 performance improvements are obtained up to 
44% (Intel Q6600) ... Have been replaced mainly mod operations.

Original issue reported on code.google.com by [email protected] on 12 Jun 2011 at 11:34

Attachments:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.