Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
ID Generation Testing
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:134.0) Gecko/20100101 Firefox/134.0
Browser:
Firefox 134
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Blaze
5039722.0 Ops/sec
Java
10363147.0 Ops/sec
djb2
10262909.0 Ops/sec
cyrb53
5591142.0 Ops/sec
cyrb53_beta1
5953420.5 Ops/sec
cyrb53a_beta2
6433020.0 Ops/sec
crypto
3606780.0 Ops/sec
splitmix32
10523655.0 Ops/sec
Script Preparation code:
function BlazeHash() { let key = String(performance.now()), seed = 0, keyLength = 6; let h1 = 0xcafebabe ^ seed, h2 = 0xdeadbeef ^ seed, i = 0; for(let b = keyLength & -8; i < b; i += 8) { h1 ^= key[i+3] << 24 | key[i+2] << 16 | key[i+1] << 8 | key[i ]; h2 ^= key[i+7] << 24 | key[i+6] << 16 | key[i+5] << 8 | key[i+4]; h1 ^= Math.imul(h2 ^ (h2 >>> 15), 0xca9b4735); h2 ^= Math.imul(h1 ^ (h1 >>> 16), 0x38b34ae5); } switch(keyLength & 7) { case 7: h2 ^= key[i+6] << 16; case 6: h2 ^= key[i+5] << 8; case 5: h2 ^= key[i+4]; case 4: h1 ^= key[i+3] << 24; case 3: h1 ^= key[i+2] << 16; case 2: h1 ^= key[i+1] << 8; case 1: h1 ^= key[i]; h1 ^= Math.imul(h2 ^ (h2 >>> 15), 0xca9b4735); h2 ^= Math.imul(h1 ^ (h1 >>> 16), 0x38b34ae5); } h1 ^= keyLength ^ h2; h1 ^= Math.imul(h1 ^ (h2 >>> 15), 0x735a2d97); h2 ^= Math.imul(h2 ^ (h1 >>> 15), 0xcaf649a9); h1 ^= h2 >>> 16; h2 ^= h1 >>> 16; return [h1 >>> 0, h2 >>> 0]; //return 2097152 * (h2 >>> 0) + (h1 >>> 11); } function javaStringHash() { let key = String(performance.now()), keyLength = 6; var hash = 0; for (var i = 0; i < keyLength; i++) { hash = ((hash << 5) - hash) + key.charCodeAt(i); hash |= 0; // Convert to 32bit integer } return hash; } function djb2() { let key = String(performance.now()), keyLength = 6, hash = 5381; for (var i = 0; i < keyLength; i++) { hash = ((hash << 5) + hash) + key.charCodeAt(i); hash |= 0; // Convert to 32bit integer } return hash; } function cyrb53() { let key = String(performance.now()), seed = 0, keyLength = 6; var h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed; for (var i = 0; i < keyLength; i++) { var ch = key.charCodeAt(i); h1 = Math.imul(h1 ^ ch, 2654435761); h2 = Math.imul(h2 ^ ch, 1597334677); } h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909); h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909); return 4294967296 * (2097151 & h2) + (h1 >>> 0); }; const cyrb53_beta1 = function() { let key = String(performance.now()), seed = 0, keyLength = 6; let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed; for(let i = 0, ch; i < keyLength; i++) { ch = key.charCodeAt(i); h1 = Math.imul(h1 ^ ch, 2654435761); h2 = Math.imul(h2 ^ ch, 1597334677); } h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507); h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909); h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507); h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909); return 4294967296 * (2097151 & h2) + (h1 >>> 0); }; /* cyrb53a beta (c) 2023 bryc (github.com/bryc) License: Public domain (or MIT if needed). Attribution appreciated. This is a work-in-progress, and changes to the algorithm are expected. The original cyrb53 has a slight mixing bias in the low bits of h1. This doesn't affect collision rate, but I want to try to improve it. This new version has preliminary improvements in avalanche behavior. */ const cyrb53a_beta2 = function() { let key = String(performance.now()), seed = 0, keyLength = 6; let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed; for(let i = 0, ch; i < keyLength; i++) { ch = key.charCodeAt(i); h1 = Math.imul(h1 ^ ch, 0x85ebca77); h2 = Math.imul(h2 ^ ch, 0xc2b2ae3d); } h1 ^= Math.imul(h1 ^ (h2 >>> 15), 0x735a2d97); h2 ^= Math.imul(h2 ^ (h1 >>> 15), 0xcaf649a9); h1 ^= h2 >>> 16; h2 ^= h1 >>> 16; return 2097152 * (h2 >>> 0) + (h1 >>> 11); }; function splitmix32() { let a = performance.now() a |= 0; a = a + 0x9e3779b9 | 0; var t = a ^ a >>> 16; t = Math.imul(t, 0x21f0aaad); t = t ^ t >>> 15; t = Math.imul(t, 0x735a2d97); return ((t = t ^ t >>> 15) >>> 0) / 4294967296; }; function MurmurHash1() { let key = String(performance.now()), seed = 0, keyLength = 6, m = 3332679571, h = Math.imul(key.length, m) ^ seed; for(var i = 0, b = keyLength & -4; i < b; i += 4) { h += key[i+3] << 24 | key[i+2] << 16 | key[i+1] << 8 | key[i]; h = Math.imul(h, m); h ^= h >>> 16; } switch(keyLength & 3) { case 3: h += key[i+2] << 16; case 2: h += key[i+1] << 8; case 1: h += key[i]; h = Math.imul(h, m); h ^= h >>> 16; } h = Math.imul(h, m); h ^= h >>> 10; h = Math.imul(h, m); h ^= h >>> 17; return h >>> 0; };
Tests:
Blaze
BlazeHash()
Java
javaStringHash()
djb2
djb2()
cyrb53
cyrb53()
cyrb53_beta1
cyrb53_beta1()
cyrb53a_beta2
cyrb53a_beta2()
crypto
crypto.randomUUID()
splitmix32
splitmix32()
MurmurHash1
MurmurHash1()