Hacker News new | past | comments | ask | show | jobs | submit login
MurmurHash 2.0 (googlepages.com)
34 points by kqr2 on May 24, 2009 | hide | past | favorite | 10 comments



I VERY much dislike such webpages where there is no information what it is. Stop assuming some knowledge and start of the webpage with a two line description of what the project is.


The name of the project tells you what it does. If you don't understand from the name of the project, you'll certainly have no use for it.


It's a hash container, right? I do have a use for it, but it took some serious investigation to find out anything about it. The poster you replied to was spot on.


Come on, there's even a Wikipedia page for it: http://en.wikipedia.org/wiki/MurmurHash


If someone manages to port the 64-bit version to Java (which probably requires some JNI or JNA work), I would be very happy.


I just ported it to Java. It took me five minutes.

It's 40 lines of C++, most of which are of the `k *= m;` variety. You literally paste in the C++, fix the type declarations, and replace the point increment looping with standard indexed array iteration. Remember to replace `const` with `final` and you're done.

Using JNI for a high-speed hash function makes only slightly more sense than putting a SOAP interface on it.


Yes, and those "k = m" lines are the problem! Those assume unsigned* types! And 64-bit integers! Those multiplications and other operations are all wrong!

You didn't port this to Java, you ported a broken algorithm to Java. Way to go, though.


Sorry, not 64-bit integers but you get my drift.


What puzzled me here was that it took so many years for someone to optimize this. I looked at the code and dug around for 'barrel shifters'.

Funnily enough, this page http://answers.google.com/answers/threadview?id=388350 says that in 1986 both the i386 and 68030 came with one, but it was missing from the Pentium 4.


I doubt the Pentium 4 had no barrel shifter, as its shift instructions have single-cycle latency. It does seem, however, that the Prescott can do rotate instructions in one cycle while the Northwood took 4 (thanks, Mubench!).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: