Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array iteration - filter vs forEach
(version: 0)
Comparing performance of:
forEach + if vs filter + forEach
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = []; for (i=0; i<=99999; i++) { arr[i] = i; } var brr =[];
Tests:
forEach + if
arr.forEach(el => {if (el%3 === 0) brr.push(el)});
filter + forEach
var res = arr.filter(el => el%3 ===0); res.forEach(el => brr.push(el));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
forEach + if
filter + forEach
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!
Comments
Confirm delete:
Do you really want to delete benchmark?