You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are not taking in consideration time needed to work with memory, but you have to in such tests, where main work depends exactly on construction of big arrays and freeing them before next test.
Simple example.
In mapPerformance(posts) execution time of "forEach" depends on running order,
just move "forEach" block before "for loop", and you will see it starts to run "faster" than "for loop".
I have changed order and added 2 copies of tests, several runs:
posts.length: 100000
You are not taking in consideration time needed to work with memory, but you have to in such tests, where main work depends exactly on construction of big arrays and freeing them before next test.
Simple example.
In mapPerformance(posts) execution time of "forEach" depends on running order,
just move "forEach" block before "for loop", and you will see it starts to run "faster" than "for loop".
I have changed order and added 2 copies of tests, several runs:
posts.length: 100000
What we see? What conclusion?
What can we say with confidence?
Just that forEach and for loop have no difference and you can choose what you want.
PS:
node v10.16.1
The text was updated successfully, but these errors were encountered: