Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
lookup vs hash
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Mobile/15E148 Safari/604.1
Browser:
Mobile Safari 18
Operating system:
iOS 18.5
Device Platform:
Mobile
Date tested:
10 months ago
Test name
Executions per second
hashlookup
7548.2 Ops/sec
hashswitch
32790.3 Ops/sec
Tests:
hashlookup
const md5 = '11111111111111111111111111111111'; const sha1 = '1111111111111111111111111111111111111111'; const sha256 = '1111111111111111111111111111111111111111111111111111111111111111'; const invalid = '21345'; const size = 10000; const hashLookup = ( () => { const hashes = { 32: 'md5', 64: 'sha256', 40: 'sha1' }; return function( hash ) { return hashes[ hash.length ]; }; } )(); for ( let i = 0; i < size; i++ ) { hashLookup(md5); hashLookup(sha1); hashLookup(sha256); hashLookup(invalid); }
hashswitch
let md5 = '11111111111111111111111111111111'; let sha1 = '1111111111111111111111111111111111111111'; let sha256 = '1111111111111111111111111111111111111111111111111111111111111111'; let invalid = '21345'; const size = 10000; hashSwitch = function hashSwitch( hash ) { switch( hash.length ) { case 32: { return 'md5'; } case 40: { return 'sha1'; } case 64: { return 'sha256'; } } } for ( let i = 0; i < size; i++ ) { hashSwitch(md5); hashSwitch(sha1); hashSwitch(sha256); hashSwitch(invalid); }