Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Filter vs for
(version: 1)
Comparing performance of:
Filter vs for of
Created:
one year ago
by:
Registered User
Jump to the latest result
Script Preparation code:
window.parentObj = []; for (let i = 0; i < 1000; i++) { window.parentObj.push(Math.floor(Math.random() * 4294967295)); }
Tests:
Filter
const newObj = window.parentObj.filter(n => n % 2);
for of
const newObj = []; for (const n of window.parentObj) { if ((n % 2) === 0) { newObj.push(n); } }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Filter
for of
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Browser/OS:
Chrome 130 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Filter
72989.7 Ops/sec
for of
66474.1 Ops/sec
Related benchmarks:
Some vs. Filter
Some vs. Filter vs. indexOf
Some vs. Filter vs. indexOf
Some vs. Filter vs. indexOf
Some vs. Filter vs. indexOf 1
Some vs. Filter vs. indexOf vs every
Some vs. Filter vs. indexOf (object)
filter vs reduce vs slice-splice
filter vs for performance
Comments
Confirm delete:
Do you really want to delete benchmark?