Deferred, Angular (1 or 2) and code size.

124 views
Skip to first unread message

Cristian Garcia

unread,
Apr 23, 2015, 1:23:12 PM4/23/15
to mi...@dartlang.org
The hello world for AngularDart is 600k once compiled with dart2js. If you are not doing a "app" but more of a webpage with some logic, this is a deal breaker. The thing with Angular is that you don't see anything until it has loaded, not even broken functionality, you literally see a white page before the router kicks in. Can "deferred" help in anyway? Will Angular 2 try to address and will this work for Dart when compiled to JS? Or is there is no hope and we just walk of to some jQuery or React port if we care about load times?

Jos Hirth

unread,
Apr 23, 2015, 2:03:36 PM4/23/15
to mi...@dartlang.org
The Angular 2 page suggests that the size problem will be addressed in the future:


"The generated JavaScript will be smaller once Angular's transformer becomes available."

Cristian Garcia

unread,
Apr 23, 2015, 7:55:14 PM4/23/15
to mi...@dartlang.org
Yeah, but AngularDart (1.x) has a transformer and a "hello world" is 600K (no gzip), I haven't tested on Angular2 tho.

--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.

Yegor Jbanov

unread,
Apr 24, 2015, 2:42:42 PM4/24/15
to mi...@dartlang.org
Hi, all,

Disclaimer: I'm on the Angular team, looking after the Angular 2 for Dart and I used to be a user of AngularDart 1.

Please see my answers inline:

Yeah, but AngularDart (1.x) has a transformer and a "hello world" is 600K (no gzip), I haven't tested on Angular2 tho.

The transformer for Angular 1 was designed primarily to replace mirrors. The result was a bump in speed and some reduction in code size because unlike mirrors AngularDart only retains symbols in your template code. That said the transformer did not affect the overall design of AngularDart, and unfortunately its design misses some of the tree-shaking and optimizations of dart2js. To fix this in Angular 2 is a huge priority.

Angular 2 transformers are not ready yet. You wouldn't see anything incredible if you tried it today. I think our latest "hello world" was just over 300K, but we haven't even started optimizing the transformers and we're still shipping the compiler steps that we also execute in the transformer with the app.

The hello world for AngularDart is 600k once compiled with dart2js. If you are not doing a "app" but more of a webpage with some logic, this is a deal breaker.

I (personally) agree with this. AngularDart feels primarily optimized for single-page applications, not for web-sites with many pages. The tradeoffs are different between the two. For an application, you might prefer take some hit on page load time if it allows you to make the incremental updates perform better. This is because applications tend to be loaded once and used for extended periods of time without refreshing the page. That said page load should be as fast as possible and it's a high priority for Angular 2 as well.

The thing with Angular is that you don't see anything until it has loaded, not even broken functionality, you literally see a white page before the router kicks in. Can "deferred" help in anyway? Will Angular 2 try to address and will this work for Dart when compiled to JS? Or is there is no hope and we just walk of to some jQuery or React port if we care about load times?

jQuery (or in Dart case dart:html) is probably the best option if you want to render a web page gradually. React seems also designed primarily for single-page applications and not web pages, but I hear good things about its start up time. Might be worth a try.

Cheers,
Yegor

Cristian Garcia

unread,
Apr 24, 2015, 9:07:17 PM4/24/15
to mi...@dartlang.org
Yegor, thanks for the info!

300K sounds much better, it should be less than 100K when gzipped which starts sound affordable. My problem is that I am in a mixed state of concerns:
1. We are currently selling a webpage with some logic to some and most people expect the page to load fast.
2. We want to resell the same functionality (fronend logic and backend) and only change the html's for each costumer. Angular is perfect for this because it perfectly decouples controller (component) from view (html), so one dart file would serve totally different html's as long as they refer to the have fields and methods somehow.

The problem with React is that it logic and view are somehow mixed. The port for Dart seems pretty nice, there are even pure Dart frameworks such as TagTree and UIX, but the problem remains. For now we will take the React approach while Angular2 matures.

Reply all
Reply to author
Forward
0 new messages