refactor(ivy): remove forEach usage in ApplicationRef.tick (#29543)

forEach is slower as compared to a regular loop but more importantly
this change removes an anonymous function and thus makes stack traces
shorter and easier to read (important for perf analysis).

PR Close #29543
This commit is contained in:
Pawel Kozlowski 2019-03-27 14:19:15 +01:00 committed by Miško Hevery
parent 96b800c8bc
commit 4eb6b02f08
1 changed files with 6 additions and 2 deletions

View File

@ -630,9 +630,13 @@ export class ApplicationRef {
const scope = ApplicationRef._tickScope();
try {
this._runningTick = true;
this._views.forEach((view) => view.detectChanges());
for (let view of this._views) {
view.detectChanges();
}
if (this._enforceNoNewChanges) {
this._views.forEach((view) => view.checkNoChanges());
for (let view of this._views) {
view.checkNoChanges();
}
}
} catch (e) {
// Attention: Don't rethrow as it could cancel subscriptions to Observables!