Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
1363254132431453543542435642653465243652
(version: 0)
Comparing performance of:
map vs for vs for of
Created:
4 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = []; for (var i = 0; i < 12345; i++) { arr[i] = i; } function someFn(i) { return (i * 3 * 8 / 1200 * 0.002 / 40 * 0.2); }
Tests:
map
let array = arr.map(item => someFn(item));
for
let array = []; for (var j = 0; j < arr.length; j++) { array.push(someFn(arr[j])); }
for of
let array = []; for (const elt of arr) { array.push(someFn(elt)); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
map
for
for of
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:
for vs jQuery each
for vs jQuery each 2
Lodash.js vs Native MAGIC
filter with forEach vs for with if
js forEach vs for..of for @nodejs_ru
Comments
Confirm delete:
Do you really want to delete benchmark?