Consider using `:erlang.phash2/1` as the hash function
tanguilp opened this issue · comments
If requirements are met, consider using :erlang.phash2/1
as the hash function which works on any erlang term.
It allows removing the Murmur dependency.
Note that it doesn't have a uniform output:
iex(9)> :erlang.phash2(:a)
97
iex(10)> :erlang.phash2(:b)
98
Not sure whether it's a problem or not.
Actually ... it might even be an advantage ... The resulting merkle tree would be denser than if you used a hash function that distributed hashes evenly.
Turns out :erlang.phash2
is about twice as fast according to my benchmarks... Thanks for the suggestion! 🎉