DEV Community

Discussion on: Speed Up Your Javascript With These Simple Methods

Collapse
 
frankwisniewski profile image
Frank Wisniewski

That's why I wrote, if it's faster at all...

Thread Thread
 
bradtaniguchi profile image
Brad

Yea I noticed that and wanted more insight, so I dug into it more.

It would appear the execution speed is affected by the order/definition.

I saw improvements when flipping the order of execution where the "faster" method goes second, rather than first and the execution ends up faster. I'm not really sure why this is.

I also removed the slower/faster pieces of code so the code only focuses on only 1 implementation and got similar behavior where the faster version does go faster, but only a little.

So end all, yes the "faster" optimization is an optimization. But even then you're only looking at slightly faster execution speeds in the realm of .05 of a second improvements for 10 million elements. (at least on my machine)