After my last lecture I got some comments, found some resources and I updated my slides.
Some highlights of things that has changed:
Trace JIT is no more
I was surprised by the news that trace JIT was removed from Firefox trunk. I hoped that it will grow and replace method JIT completely one day. Post from from David Mandelin explains details behind this decision.
Method JIT works better than I expected
During my talk I stated that using config object (which e.g. jQuery plugins do) may break JIT and that the safest way is to use integer and float arguments only.
I got a very detailed description from Rob Brackett on how JIT works with objects:
Passing config objects to functions can often cause them to run slower — most engines use a concept of “shape” to JIT code related to objects (shape is basically the set of keys on your object, so {a:”a”, b:”b”} and {a:”c”, b:”d”} are the same shape but {a:”a”, c:”b”} is a different shape). The function will generally have to be JITed once for each shape that is passed in. Some engines stop re-JITing after they’ve seen a certain number of shapes (the threshold is different for different engines) and some do not.
My second statement, about integers and floats was based on NanoJIT capabilities. Since it was removed from Firefox with Trace JIT, I can now safely say that any argument type that fulfill static “shape” description above can be JITed.
Source: http://groups.google.com/group/jsmentors/browse_thread/thread/9286c04c908cd722
Reflow is blocking
I got a question, if reflow has been or could be moved to separated thread, so it won’t be blocking. The short answer is “no”. There are plenty of functions that depend on calculated result and it would require synchronizing very often. The list of functions that require reflow to be completed.
More
It was linked in my slides, but I’d like to say it again – read David Madelin’s slides Know Your Engines from Velocity Conf 2011. It’s the most detailed source about engines I’ve found so far.
I’ve asked some questions on JSMentors group, you may want to check it out.
Bonus: some photos from the event


