Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
automatic casting int to boolean casting vs int comparison
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 OPR/87.0.0.0
Browser:
Opera 87
Operating system:
Android
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
automatic casting
77837.3 Ops/sec
int comparison
75093.7 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const array = [] for(let i=0; i<1000; i++){ array.push(Math.random() < 0.5 ? 0 : 1) }
Tests:
automatic casting
let result = 0 for(let i=0;i<array.length;i++){ if(array[i]){ result++ } }
int comparison
let result = 0 for(let i=0;i<array.length;i++){ if(array[i] === 1){ result++ } }