Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Simple string compare vs MurmurHash on a large string
Worst case large string comparison.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Browser:
Chrome 119
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
===
1203.9 Ops/sec
murmurhash3_32_gc
9.2 Ops/sec
Script Preparation code:
let s10MB = "0123456789".repeat(1000*1000); var strings10MB = Array.from(Array(20)).map(o=>s10MB + String.fromCharCode(32+~~(Math.random()*96)))
Tests:
===
const s1 = strings10MB[~~(strings10MB.length*Math.random())]; const s2 = strings10MB[~~(strings10MB.length*Math.random())]; const b = s1 === s2;
murmurhash3_32_gc
function murmurhash3_32_gc(str) { var h1 = 0xdeadbeef; var k1 = 0; for (var i = 0; i < str.length; ++i) { k1 = str.charCodeAt(i); k1 = (k1 & 0x0000ffff) | ((k1 & 0xffff0000) >>> 16); k1 *= 0xcc9e2d51; k1 = (k1 << 15) | (k1 >>> 17); h1 ^= k1; h1 = (h1 << 13) | (h1 >>> 19); h1 = h1 * 5 + 0xe6546b64; } h1 ^= str.length; h1 ^= h1 >>> 16; h1 *= 0x85ebca6b; h1 ^= h1 >>> 13; h1 *= 0xc2b2ae35; h1 ^= h1 >>> 16; return h1 >>> 0; // Convert to unsigned 32-bit integer } const s1 = strings10MB[~~(strings10MB.length*Math.random())]; const s2 = strings10MB[~~(strings10MB.length*Math.random())]; const hash1 = murmurhash3_32_gc(s1); const hash2 = murmurhash3_32_gc(s2); const b = hash1 === hash2;