Jump to content

Faster JavaScript


Recommended Posts

There are currently two interesting debates going on at HackerNews about JS libs providing functions faster than native JS functions. The trick is to not implement all edge cases the standard expects. E. g. if you loop over an array and know it has no holes you can drop that check. Now at http://jsperf.com/fast-vs-lodash a test case appeared showing fast.js vs. lowdash.js vs. native giving me very mixed results with FF 29 and FF later.

A few of the test cases shouldn't be used at all if one wants to go very fast, like forEach vs a simple while loop. But on the other hand fast.js has an indexOf which is surprisingly 15 times faster than the native. Since I tend to implement number crunching parts of a program in small, optimized and inline-able functions, I found some results an eye-opener. And it made clear the JS pathfinder has room for optimizations.

Yves, if you read this, it might be a good idea to stick a while longer with SM29.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...