Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Some vs. Filter vs. findIndex with object
(version: 0)
Comparing performance of:
Array.some vs Array.filter vs Array.findIndex
Created:
3 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var hasZero = []; var withoutZero = []; for (var i = 0; i < 10000; i++) { hasZero.push({num: Math.floor(Math.random() * 1000)}); withoutZero.push({num: Math.floor(Math.random() * 1000) + 1}) }
Tests:
Array.some
var tempResult = !!Math.round(Math.random()) ? hasZero.some(v => v.num === 0) : withoutZero.some(v => v.num === 0);
Array.filter
var tempResult = !!Math.round(Math.random()) ? hasZero.filter(v => v.num === 0) : withoutZero.filter(v => v.num === 0);
Array.findIndex
var tempResult = !!Math.round(Math.random()) ? hasZero.findIndex(v => v.num === 0) : withoutZero.findIndex(v => v.num === 0);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Array.some
Array.filter
Array.findIndex
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Some vs. Filter vs. findIndex again
Some vs. Filter vs. findIndex
Some vs. Filter vs. findIndex vs find
benchmark filter vs findIndex
Comments
Confirm delete:
Do you really want to delete benchmark?