Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
aze a eqsaze qsd
(version: 1)
aze
Comparing performance of:
some vs find vs map indexOf
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var hasZero = []; var withoutZero = []; for (var i = 0; i < 10000; i++) { hasZero.push({a: Math.floor(Math.random() * 1000)}); withoutZero.push({a: Math.floor(Math.random() * 1000) + 1}) }
Tests:
some
var tempResult = !!Math.round(Math.random()) ? hasZero.some(v => v.a === 0) : withoutZero.some(v => v.a === 0);
find
var tempResult = !!Math.round(Math.random()) ? hasZero.some(v => v.a === 0) : withoutZero.find(v => v.a === 0);
map indexOf
var tempResult = !!Math.round(Math.random()) ? hasZero.map(v => v.a).indexOf(0) > -1 : withoutZero.map(v => v.a).indexOf(0) > -1;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
some
find
map indexOf
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
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/OS:
Chrome 126 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
some
200958.0 Ops/sec
find
192906.8 Ops/sec
map indexOf
50781.1 Ops/sec
Comments
Confirm delete:
Do you really want to delete benchmark?