www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - IsItThere - a small tool that generates perfect hash sets

reply Basile B. <b2.temp gmx.com> writes:
"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:

https://code.dlang.org/packages/isitthere
https://github.com/BBasile/IsItThere
https://en.wikipedia.org/wiki/Perfect_hash_function
Jan 06
parent Basile B. <b2.temp gmx.com> writes:
On Friday, 6 January 2017 at 23:27:54 UTC, Basile B. wrote:
 "IsItThere ?" is a small tool that generates perfect hash sets.
Important fix pushed today. Pull recommended if you've cloned !
Jan 09