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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0
Browser:
Chrome 142
Operating system:
Windows
Device Platform:
Desktop
Date tested:
5 months ago
Test name
Executions per second
hashlookup
3570.5 Ops/sec
hashswitch
10656.2 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); }