Murmurhash 3 vs md5 (v3)

Revision 3 of this benchmark created on


Preparation HTML

<script src="https://rawgithub.com/garycourt/murmurhash-js/master/murmurhash3_gc.js">
</script>
<script src="https://rawgithub.com/kvz/phpjs/master/functions/xml/utf8_encode.js"></script>
<script src="https://rawgithub.com/kvz/phpjs/master/functions/strings/md5.js">
</script>
<script src="https://rawgithub.com/jedisct1/siphash-js/master/lib/siphash.js"></script>

Setup

var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=`[]\\;',./{}|:\"<>?",
      alphabetLength = alphabet.length;
    
    var testStrings = [],
      i = 0,
      j = 0,
      testCount = 100,
      length = 50;
    
    for (i = 0; i < testCount; i++) {
      var newStr = "";
      for (j = 0; j < length; j++) {
        newStr += alphabet[Math.floor((Math.random() * alphabetLength))];
      }
      testStrings[i] = newStr;
    }

Test runner

Ready to run.

Testing in
TestOps/sec
MurmurHash3
for (i = 0; i < testCount; i++) {
  var a = murmurhash3_32_gc(testStrings[i], 6802145);
}
ready
MD5
for (i = 0; i < testCount; i++) {
  md5(testStrings[i]);
}
ready
SipHash
for (i = 0; i < testCount; i++) {
  SipHash.hash([6802145, 0, 0, 0], testStrings[i]);
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.