2013-10-31

Dart to Javascript output size: what a difference a year makes.


About a year ago I posted on the improving output size of Dart to Javascript (dart2js) compiler.

For Pop, Pop, Win!, I was taking the ~441KB output from dart2js, pumping it through the Google Closure Compiler to get a Javascript file around 389K.

With gzip over the wire, the download size was 90KB.

My words at the time:
I certainly don't feel I need to justify the javascript output size for non-trivial apps anymore.
That was with build 15005 of the Dart SDK.

What a difference a year makes.

Today, with the latest trunk release – v0.8.9, build 29656 – we are doing even better.


The dart2js compiler, without the help of other tools, is generating an output file around 263KB. That's 40% smaller that a year ago.

The gzip size – which is what really matters, since it's the cost-on-the-wire – is at 70.5KB. Over 20% smaller.

This includes content like the texture mapping data which is 39KB on disk.

For an app with high quality images, audio, and fonts the total cost of the compiled code come in right at 4% of the total download for the app.

Impressive!