Several performance updates to the Angular 1 version
Added several performance fixes to the Angular 1 version
Thanks for looking into the performance of this demo.
Your most significant change is the localApply = false for the call to $timeout with a local digest. I specifically chose not to do that for this demo because this was meant to simulate an AJAX request with $http, which does not provide a localApply feature.
This demo was meant to be representative of Angular apps in general, which are usually not designed to keep track of which scopes changed, because Angular 1 encourages global digest.
TL;DR As you show, Angular 1 is not inherently slow. This demo, along with virtually any Angular 1 app, could be optimized to be fast, but app developers would have to depart from idiomatic Angular code to do so.
@lgalfaso Also, did you see any improvement to the initial load speed with these changes? I do not.
The initial built of the table is about the same with or without the changes. If the random timeout is set to 10 (or 0) then the loadAll performance is comparable with react (or slightly better). Note that the fact that $timeout is a promise was used and this is also true for $http. On the other side, it is true that global digests are recommended (or at least what most people use)
Agreed on all points.
This demo showed two things:
- Initial DOM loading in Angular 1 is slow.
- Global digests are slow.
I think it showed those points well enough, and while there are good solutions for #2, there are basically no solutions for #1 to my knowledge. Do you know of any?
I do not know if I would call them "good", I would just say that there are solutions for #2 if you know what you are doing. For #1 there are solutions too, but none that I know of that would keep the code easy to read