Skip to content

Commit

Permalink
perf(ivy): limit TNode.inputs reads on first template pass (angular#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
pkozlowski-opensource authored and ODAVING committed Oct 18, 2019
1 parent cc5b2cc commit d28762e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
12 changes: 1 addition & 11 deletions packages/core/src/render3/instructions/element.ts
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
}
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/render3/instructions/shared.ts
Expand Up @@ -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;
}
Expand Down

0 comments on commit d28762e

Please sign in to comment.