News for hackers. Stuff that matters.
Re:Angular 2: Built on TypeScript by ahoge on Thursday March 05, 2015 @12:59PM (#9152536)
> And the size of helloworld.dart.app.js is 102k

No, it's not.

  dart2js --minify hello.dart -o hello.dart.js
Results in a 5 KB JS file.

This game is 35 KB (procedural graphics included):

http://mbtic.com/games/fuzetsu

Re:Angular 2: Built on TypeScript by ratbeard on Thursday March 05, 2015 @01:25PM (#9152737)
I imagine they've improved the runtime size since that stack overflow post was posted a few years ago. However I've never used dart and just tried it out using a basic html sample from the tutorial page and I see:

    264 Mar  5 12:21 a.dart
    237K Mar  5 12:21 a.js
    101K Mar  5 12:22 a.min.js

It was also slow to compile, 6 secs.

Anything I'm missing?

https://gist.github.com/ratbeard/70902d6347ad448de0a4

Re:Angular 2: Built on TypeScript by ahoge on Thursday March 05, 2015 @01:55PM (#9153001)
If you add gzip compression, it's still smaller than doing the same thing with jQuery. "dart:html" provides an idiomatic DOM API where all list-like things are actually Lists, events are streams, Futures instead of callbacks, and so forth. It's pretty nice to use, but it's also one of the bulkier libraries.

Also note that you could now add a thousand lines of code and the file size wouldn't increase much. You already paid that one-time cost.

You can further improve the size by using a better minifier on top of --minify.

Re:Angular 2: Built on TypeScript by ratbeard on Thursday March 05, 2015 @02:17PM (#9153144)
Ah, that makes sense re:same size as if you added jquery, and the API abstractions do sound better.

Though as a counterpoint (and relevant to angular 2 :) I read they're going to just use the raw dom api's instead of a jquery/jquery-lite abstraction layer as the dom api's don't need the smoothing over in modern browsers like they used to.