"IsItThere ?" is a small tool that generates perfect hash sets.
Its results are formatted as ready to use D code.

I initially created it for Coedit highlighter. In this version it's not anymore a simple script but a full command-line tool that's able to generate D code.

- Why ?

When you have a small and constant set of words it's not useful to use a hash set that's build at run-time.

- How ?

For a small set of words, probabilities exist that there's a hash function able to produce different results for each element (i.e always 0 or 1 element per bucket). IsItThere finds this hash function, using brute force and a PRNG. To be more exact, it doesn't find the hash function but rather the coefficients that produce the same results as this hypothetical function. Using coefficients is even faster than a real hash function since they are allocated in a static array.

- Links:


Reply via email to