5 ms·
MurmurHash 2.0
- jmhodges 17y agoIf someone manages to port the 64-bit version to Java (which probably requires some JNI or JNA work), I would be very happy.
- codahale 17y agoI 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.
- jmhodges 17y agoYes, 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.
- jmhodges 17y agoSorry, not 64-bit integers but you get my drift.
- markessien 17y agoI 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.
- vomjom 17y agoThe 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.
- thras 17y agoIt'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.
- dchest 17y agoCome on, there's even a Wikipedia page for it: http://en.wikipedia.org/wiki/MurmurHash http://en.wikipedia.org/wiki/MurmurHash
- ableal 17y agoWhat 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 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.
- DarkShikari 17y agoI 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!).