Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
String Big array comparision 2
Bitwise big array comparision. Goal of this test is to figure out wether it's more efficient to find 1 out of many checksums as string or integer.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0
Browser:
Firefox 129
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
1 or 0 out of 10 million 32 byte arrays
42.0 Ops/sec
1 or 0 out of 10 million 96 byte arrays
26.9 Ops/sec
1 or 0 out of 10 million 160byte arrays
26.7 Ops/sec
Script Preparation code:
// Create a random string of length 32 var r32str = Array.from({ length: 32 }, () => String.fromCharCode(Math.floor(Math.random() * 256))).join(''); // Create an array of 5000 random strings, each of length 32 var mil32str = Array.from({ length: 1_000_000 }, () => Array.from({ length: 32 }, () => String.fromCharCode(Math.floor(Math.random() * 256))).join('') ); // Create a random string of length 32 var r96str = Array.from({ length: 96 }, () => String.fromCharCode(Math.floor(Math.random() * 256))).join(''); // Create an array of 5000 random strings, each of length 32 var mil96str = Array.from({ length: 1_000_000 }, () => Array.from({ length: 96 }, () => String.fromCharCode(Math.floor(Math.random() * 256))).join('') ); // Create a random string of length 32 var r160str = Array.from({ length: 160 }, () => String.fromCharCode(Math.floor(Math.random() * 256))).join(''); // Create an array of 5000 random strings, each of length 32 var mil160str = Array.from({ length: 1_000_000 }, () => Array.from({ length: 160 }, () => String.fromCharCode(Math.floor(Math.random() * 256))).join('') );
Tests:
1 or 0 out of 10 million 32 byte arrays
// Compare the random string against each string in the array const b = mil32str.some(str => str === r32str);
1 or 0 out of 10 million 96 byte arrays
// Compare the random string against each string in the array const b = mil96str.some(str => str === r96str);
1 or 0 out of 10 million 160byte arrays
// Compare the random string against each string in the array const b = mil96str.some(str => str === r96str);