[erlang-questions] optimize the megahash (Re: how to do faster integer operations)

Roger Larsson <>
Thu Jun 7 23:00:08 CEST 2007


Another possibility might be to use Erlangs handling of bigger than word size 
values.

I noticed a speedup by removing some 'band 16#FFFFFFFF'
but I did not check if it still produced the correct result - it should since 
I kept the final one (modulo arithmetic ).

If you have a mathematical description of the algorithm it might be possible 
to convert that into Erlang directly (not passing an optimized C version).
But it the algorithm works on bits you might need to use the common C
optimization - precalculation - for any input databyte calculate the output 
and state changes in advance, letting you algorithm process one byte at a 
time instead of one bit.

Do you have a link to any internet description of this hash function? (RFC?)

/RogerL 



More information about the erlang-questions mailing list