Murmur3 vs MD5

JavaScript performance comparison

Test case created by Robert Fruchtman

Preparation code

<script src="https://raw.github.com/garycourt/murmurhash-js/master/murmurhash3_gc.js">
</script>
<script src="https://raw.github.com/blueimp/JavaScript-MD5/master/md5.js">
</script>
      
<script>
Benchmark.prototype.setup = function() {
  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;
  }

};
</script>

Preparation code output

<script src="https://raw.github.com/blueimp/JavaScript-MD5/master/md5.js"> </script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
MurmurHash3
for (i = 0; i < testCount; i++) {
  murmurhash3_32_gc(testStrings[i], 6802145);
}
pending…
MD5
for (i = 0; i < testCount; i++) {
  md5(testStrings[i]);
}
pending…

Compare results of other browsers

Revisions

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

0 Comments