Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array.some vs for loop
Compare loop performance
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/123.0.0.0 Safari/537.36
Browser:
Chrome 123
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
for
579678.1 Ops/sec
some
723604.8 Ops/sec
Script Preparation code:
var array = new Array(1000).fill(''); array = array.map((tem, idx) => idx) var result = false;
Tests:
for
for (var i = 0; i < array.length; i++) { if (array[i] === 888) { result = true; break; } }
some
result = array.some(function(i) { return array[i] === 888; });