Re:Show HN: All-pair similarity search on millions of sets i...
by ekzhu on Monday November 19, 2018 @09:42PM
(#18491477)
Interesting. I thought the Python builtin hashlib was more convenient (and more random). But yes you are right, good implementation of murmur3 hash is much faster.
Re:Show HN: All-pair similarity search on millions of sets i...
by a-dub on Monday November 19, 2018 @10:15PM
(#18491580)
SHA-1 is specifically built to have special properties as a secure hash function. As I understand it murmur actually comes from this world.
I also had a gander at some more of the datasketch source. I notice that you compute H_n(x) by x_n = (a_n + b_n * H_0(x)) with a_n, b_n being random seeds....
That's pretty cool, I was doing it by H_n(x) = H_n-1(x|n) and thought it would be pretty quick, but just applying a random round directly after to one hash value from precomputed seeds looks much faster.
That said, mmh3 seems to give a respectable 70% speedup! (assuming 32bit hashes are acceptable) ... actually, let's compare apples to apples:
Still pretty awesome for the little test!...
And for something more realistic:
An order of magnitude! (well, close)