Hacker News new | past | comments | ask | show | jobs | submit login
Know Your Engines - How to Make Your JavaScript Fast [pdf] (people.mozilla.com)
44 points by sharmajai on June 18, 2011 | hide | past | favorite | 6 comments



Hopefully some javascript engine maker will open up their engines to either accept javascript or the statically-typed IL that the js gets compiled into. Then someone can write some statically-typed javascript-like language for us to use. Maybe, as a first step, allow some inline-IL in the javascript code?


Very in-depth write up of how browsers interpret Javascript and how your coding style affects performance. Some useful tips at the end, although one shouldn't be taking these tips to heart and optimising prematurely. A bad algorithm can make all this fine-tuning moot.


All these presentations about optimizing JavaScript are making me think there should be an alternative to JavaScript, especially if we want to move a bunch of software to the browser. Is this really not feasible?


And then there'd be slide decks about how to optimize that language. These tips are specific to javascript, but the concepts apply to any interpreted JIT language from my understanding.


There's a lot of practical things people can do to make their JS code faster, and a bunch of impractical things too (like unrolling loops). But based on our research/experience, a huge percentage of JavaScript-related web app slowness is actually caused by inefficient DOM structures and CSS styling. Believe it or not, simple DOM mistakes can dramatically slow down insertions, event handlers (like on-click), any kind of iteration (obviously) as well as animations.

That's why we open sourced our DOM performance inspection bookmarklet, DOM Monster:

http://mir.aculo.us/2011/01/09/the-dom-monster-is-now-open-s...

If you liked this presentation, you might enjoy the book I co-wrote with Thomas Fuchs (of Scriptaculous, Prototype.js, Emile, Zepto, & Microjs fame): http://jsrocks.com


Awesome. Checking out DOM Monster right now. Thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: