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; rv:128.0) Gecko/20100101 Firefox/128.0
Browser:
Firefox 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Compare to half of max int
21006774.0 Ops/sec
Mod even/odd
20871864.0 Ops/sec
Bitwise even/odd
20994424.0 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; }