Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Bool generation from uint32
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/126.0.0.0 Safari/537.36
Browser:
Chrome 126
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Compare to half of max int
68439.0 Ops/sec
Mod even/odd
68088.0 Ops/sec
Bitwise even/odd
68333.6 Ops/sec
Script Preparation code:
function getRandomUint32(min, max) { return Math.floor(Math.random() * (max - min) + min); }
Tests:
Compare to half of max int
for(let i = 0; i < 100; i++) { const z = getRandomUint32(0, 2 ** 32) < 2_147_483_648; }
Mod even/odd
for(let i = 0; i < 100; i++) { const z = getRandomUint32(0, 2 ** 32) % 2 === 0; }
Bitwise even/odd
for(let i = 0; i < 100; i++) { const z = getRandomUint32(0, 2 ** 32) & 1 === 1; }