perf(ivy): limit TNode.inputs reads on first template pass (#32979)

PR Close #32979
This commit is contained in:
Pawel Kozlowski 2019-10-03 12:27:02 +02:00 committed by Alex Rickabaugh
parent 8593d0d52e
commit e6881b5b42
2 changed files with 10 additions and 11 deletions

View File

@ -10,7 +10,7 @@ import {assertDataInRange, assertDefined, assertEqual} from '../../util/assert';
import {assertHasParent} from '../assert';
import {attachPatchData} from '../context_discovery';
import {registerPostOrderHooks} from '../hooks';
import {TAttributes, TNodeFlags, TNodeType} from '../interfaces/node';
import {TAttributes, TNodeType} from '../interfaces/node';
import {RElement} from '../interfaces/renderer';
import {StylingMapArray, TStylingContext} from '../interfaces/styling';
import {isContentQueryHost, isDirectiveHost} from '../interfaces/type_checks';
@ -84,16 +84,6 @@ export function ɵɵelementStart(
ngDevMode && ngDevMode.firstTemplatePass++;
resolveDirectives(tView, lView, tNode, localRefs || null);
const inputData = tNode.inputs;
if (inputData != null) {
if (inputData.hasOwnProperty('class')) {
tNode.flags |= TNodeFlags.hasClassInput;
}
if (inputData.hasOwnProperty('style')) {
tNode.flags |= TNodeFlags.hasStyleInput;
}
}
if (tView.queries !== null) {
tView.queries.elementStart(tView, tNode);
}

View File

@ -843,6 +843,15 @@ function initializeInputAndOutputAliases(tView: TView, tNode: TNode): void {
outputsStore = generatePropertyAliases(directiveDef.outputs, i, outputsStore);
}
if (inputsStore !== null) {
if (inputsStore.hasOwnProperty('class')) {
tNode.flags |= TNodeFlags.hasClassInput;
}
if (inputsStore.hasOwnProperty('style')) {
tNode.flags |= TNodeFlags.hasStyleInput;
}
}
tNode.inputs = inputsStore;
tNode.outputs = outputsStore;
}