Reputation: 22964
I've been developing in Angular for a bit now and loving it. I do understand the performance implications of data binding and use the bind-once plugin and other means of minimizing watches, etc.
However, I'm wondering if, how, and when Angular applications will become significantly faster? By that I mean with all things being equal performance almost or on par with non-declarative frameworks.
Is this matter of browsers catching up to the declarative model? Do any browser currently have any plans for that?
Is it a matter of EcmaScript 6 or beyond to eventually support native "watching" of variables. (Any hope?)
Or will that take too long and Angular itself needs to improve in some clever way (any plans from the Angular team?)
Of course eventually browsers and computers in general get faster but is there anything on the horizon for Angular performance?
Upvotes: 1
Views: 176
Reputation: 4993
The way I see it, regarding bindings / change listeners etc., there are 3 possible areas of optimization:
This includes for example bindonce or the optimization of specific data structures, such as $watchGroups, which is like one watch for two or more properties (https://github.com/angular/angular.js/pull/7158). These are changes that basically anybody can implement and propose, but they don't have very high priority for the core team (although they are working on a bindonce like feature).
In angularjs 2.0, the scope change detection algorithm will be much faster than now (http://blog.angularjs.org/2014/03/angular-20.html). Another major improvement in the architcture I see would be batched DOM updates.
Object.observe() is a standardized way to listen for changes in objects. It's currently not supported by all major browsers, so this can't be used yet.
The most promising area is currently (2) as the general architecture changes will incorporate or obsolete changes in (1). I think a public alpha of angular 2.0 will be available at the earliest at the end of the year.
Upvotes: 1
Reputation: 1511
You are asking a lot of what if/theory questions. Angular is as fast as you make it. Performance is directly tied to how you application was developed. I am woking on a project with 50+ controllers that had serious performance issues as we were dealing 100,000+ records in a table. We were able to get sorts and filters from multi second transactions down to 60ms just by being smart about our decisions. Bind once is only a piece of the puzzle with performance. You really need to look at your watches. The flame chart is a great tool for this. I wrote up a pro tip on Coderwall.com about it: https://coderwall.com/p/nsanaa?i=1&p=1&q=author%3Abreck421&t%5B%5D=breck421
Also you need to be mindful and purposeful about your DOM manipulations (ng-repeat is slow).
Brian Ford just did a lightning talk about this topic:
https://github.com/breck421/brian-talks-about-angular-with-lots-of-data
Hope this helps,
Jordan
Upvotes: 1