- Notifications
You must be signed in to change notification settings - Fork5
C# .NET implementation of Murmur Hash
License
NotificationsYou must be signed in to change notification settings
jitbit/MurmurHash.net
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
C# implementation of Murmur Hash 2
Usage:
MurmurHash2.Hash("mystring");MurmurHash2.Hash(byteArray);
I wrote a small benchmark to test the number of collisions on a 466k words (list of all English words taken from here:https://github.com/dwyl/english-words) andthe number of collisions is 22 which I consider a pretty good result.
Standardstring.GetHashCode()
gives48 collisions on the 466k word list.
Elapsed time (on the 466k word list):
Hash | Elapsed time | # of collisions |
---|---|---|
MurmurHash2 | 104 ms | 22 |
GetHashCode | 47 ms | 48 |
On the numbers from1
to999999
(think ZIP codes) the results were:
Hash | Elapsed time | # of collisions |
---|---|---|
MurmurHash2 | 234 ms | 56 |
GetHashCode | 121 ms | 0 |
GetHashCode
is better with collisions here, but MurMur shines on longer texts.