In the discussion below this article there's a comment by Renan Cakirerk to the effect that, according to an Angular developer, Angular UI performance might degrade beyond 2000 data-bound objects.
It made me seriously consider whether pursuing my non-trivial app with Angular is a good idea. A good app is a fast app after all. I don't want to invest months building something to be bitten at the end.
I am interested in hearing from Angular non-trivial app builders about
- general strategies people have successfully used for dealing with performance degradation
- specific strategies based on my requirements and design pattern (below)
- whether I should abandon Angular altogether at this early stage in the project to avoid a looming "grind to halt"
It's too much of a risk to wait for the possible "ES6 power and perf boons like Object.observe
" and future versions that will might developers more fine-grained control on the $apply
/ $digest
cycle so that $scope
-limited dirty-checking can be triggered" (Brian Frichette mentions these in the same discussion). I want to know that complex apps can be fast today on v1.2.15.
More details about my problem/solution...
I'm building an app with very rich functionality, where each object (eg user) has many functions that can be done to it, eg linking them to other users, changing their properties, sending them messages, etc.
The spec has upwards of 20 functions on this object: droppable zones, context sensitive toolbar icons (eg the way Word has mini-toolbars that appear near the mouse when you select some text).
These options need to hide and show based on certain mouse actions, like hovering and dragging, and depend on the state of the particular user object (many icons and drop options will show in some circumstances and not others)
Now, the way I've started building this is to have each individual icon and drop area, drag handle, etc as a separate data-bound element with an ng-show (or similar) that's keyed into our custom business logic.
Eg
<user>
<menuicon1 ng-show="business-logic1"/>
<menuicon2 ng-show="business-logic2"/>
<dropzone1 ng-show="business-logic3"/>
<draghandle ng-show="business-logic4"/>
<changessavedicon ng-show="business-logic5"/>
.....
</user>
Assuming the 2000 theoretical limit above is to be feared, then 20 custom showable hideable bits means 100 users (shown using the amazing ng-repeat) is my limit! Maybe showing 100 is silly and I can attack this with filtering etc, but it seems to me that dividing by 20 drastically reduces my object "bandwidth". And what happens when the boss wishes to add 10 more functions?
If I were doing this the jQuery way, I'd probably construct and destroy many of the icons and menu items as needed. Slightly less responsive per hover/drag, but at least the app can scale the number of objects that way.