DEV Community

Discussion on: Array.map() much slower than for loop

Collapse
 
avatarkaleb profile image
Kaleb M • Edited

Hi Henry,

Thanks for posting this and doing a test. It's really difficult to truly test out timing of code utilizing timestamps. I recommend the two resources below to better test, because in most cases, the performance of our code is very difficult to measure properly. I'd love to see the results of doing it with a proper test for sure, and how often one has a use case for 1 mill rows of data, since it would be really helpful for us :).

Benchmarking code requires quite a bit of stats and has many factors that are hard to bench mark without a library.

I'd recommend using benchmarkjs.com/ to do your bench marking, and potentially read github.com/getify/You-Dont-Know-JS... to better understanding the proper way to do benchmarking.

I hope that helps!

Collapse
 
henryjw profile image
Henry Williams

Thanks for the recommendations. I'll definitely check out You Don't Know JS.