re: Array.map() much slower than for loop VIEW POST

FULL DISCUSSION
 

I put your code in a function and i get a perfomance hit in first call and after that its faster
First call in node 11.14.0:
loop: 270.822ms
map: 1293.307ms
Next calls in node 11.14.0:
loop: 366.816ms
map: 259.317ms
undefined

test()
loop: 304.949ms
map: 76.464ms
undefined
test()
loop: 290.823ms
map: 76.344ms
undefined
test()
loop: 293.326ms
map: 73.094ms
undefined
test()
loop: 288.508ms
map: 77.012ms

In chrome i dont get any notable performance hit by using map instead of loop with these code.

 
code of conduct - report abuse