From e6881b5b422977916bc7774d05dcea8d7becff23 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Thu, 3 Oct 2019 12:27:02 +0200 Subject: [PATCH] perf(ivy): limit TNode.inputs reads on first template pass (#32979) PR Close #32979 --- packages/core/src/render3/instructions/element.ts | 12 +----------- packages/core/src/render3/instructions/shared.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/core/src/render3/instructions/element.ts b/packages/core/src/render3/instructions/element.ts index 5c4b7c5080..6c8e1eb4a1 100644 --- a/packages/core/src/render3/instructions/element.ts +++ b/packages/core/src/render3/instructions/element.ts @@ -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); } diff --git a/packages/core/src/render3/instructions/shared.ts b/packages/core/src/render3/instructions/shared.ts index d26f1691f8..8ca5f47cc4 100644 --- a/packages/core/src/render3/instructions/shared.ts +++ b/packages/core/src/render3/instructions/shared.ts @@ -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; }