Smashinglabs

Sebastian Poręba's blog

JavaScript performance lecture followup

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


  • RSS
  • Facebook
  • Twitter

FAQ about Wordpress

This came as a surprise for me but gMap is ...

gMap 3.3.3 released

It was a looong time since I last visited gMap. ...

Talks for Google Dev

Two new slide decks appeared in lectures tab. This time with ...

Talks and lectures w

Every now and then I spend a weekend watching various ...

3D Tetris with Three

In the fifth part of tutorial we add some final ...

FAQ about Wordpress

This came as a surprise for me but gMap is ...

gMap 3.3.0 released

Christmas came early! New version of gMap is ready!

Lecture for GTUG: Ja

Today I gave a lecture for GTUG Krakow about optimizations in ...

Unit testing for jQu

In part 1 I described basics of unit testing in ...

Unit testing for jQu

In part 1 I described some basic concepts behind unit ...