3 ms·
Ugh, this lacks any contextual reason on why one is better than the other. Dirty checking a model requires a direct comparison on every digest loop, regardless
by jhall1468 11y ago
Ugh, this lacks any contextual reason on why one is better than the other. Dirty checking a model requires a direct comparison on every digest loop, regardless of whether or not the state has changed (because we don't know if the state has changed).
React runs its dirty check only after a state change obligates it to. As your model gets larger and larger, dirty-checking the model on every digest loop starts to have performance problems.
Oversimplification can be incredibly misleading.
- robwormald 11y agoThis was the case in Angular 1 - in Angular2, not so much. The component-tree structure (much like React) allows far smarter optimization on change detection - both with immutable data structures and observables - entire subtrees of components can be removed from the change detection step until the state notifies it of a change. Good reading material by a team member - http://victorsavkin.com/post/110170125256/change-detection-in-angular-2 http://victorsavkin.com/post/110170125256/change-detection-i... and http://victorsavkin.com/post/114168430846/two-phases-of-angular-2-applications http://victorsavkin.com/post/114168430846/two-phases-of-angu... An early beta comparo - http://www.roblog.io/js-repaint-perfs/angular2/opt.html http://www.roblog.io/js-repaint-perfs/angular2/opt.html vs http://www.roblog.io/js-repaint-perfs/react/opt.html http://www.roblog.io/js-repaint-perfs/react/opt.html - should probably update these with the latest RC.