perf(ivy): avoid repeated tNode.initialInputs reads (#33322)
PR Close #33322
This commit is contained in:
parent
41caafcaf2
commit
4452d6d848
|
@ -1103,6 +1103,7 @@ function instantiateAllDirectives(
|
||||||
|
|
||||||
attachPatchData(native, lView);
|
attachPatchData(native, lView);
|
||||||
|
|
||||||
|
const initialInputs = tNode.initialInputs;
|
||||||
for (let i = start; i < end; i++) {
|
for (let i = start; i < end; i++) {
|
||||||
const def = tView.data[i] as DirectiveDef<any>;
|
const def = tView.data[i] as DirectiveDef<any>;
|
||||||
const isComponent = isComponentDef(def);
|
const isComponent = isComponentDef(def);
|
||||||
|
@ -1115,8 +1116,8 @@ function instantiateAllDirectives(
|
||||||
const directive = getNodeInjectable(tView.data, lView, i, tNode);
|
const directive = getNodeInjectable(tView.data, lView, i, tNode);
|
||||||
attachPatchData(directive, lView);
|
attachPatchData(directive, lView);
|
||||||
|
|
||||||
if (tNode.initialInputs !== null) {
|
if (initialInputs !== null) {
|
||||||
setInputsFromAttrs(lView, i - start, directive, def, tNode);
|
setInputsFromAttrs(lView, i - start, directive, def, tNode, initialInputs !);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isComponent) {
|
if (isComponent) {
|
||||||
|
@ -1348,8 +1349,8 @@ export function elementAttributeInternal(
|
||||||
* @param tNode The static data for this node
|
* @param tNode The static data for this node
|
||||||
*/
|
*/
|
||||||
function setInputsFromAttrs<T>(
|
function setInputsFromAttrs<T>(
|
||||||
lView: LView, directiveIndex: number, instance: T, def: DirectiveDef<T>, tNode: TNode): void {
|
lView: LView, directiveIndex: number, instance: T, def: DirectiveDef<T>, tNode: TNode,
|
||||||
const initialInputData = tNode.initialInputs as InitialInputData;
|
initialInputData: InitialInputData): void {
|
||||||
const initialInputs: InitialInputs|null = initialInputData ![directiveIndex];
|
const initialInputs: InitialInputs|null = initialInputData ![directiveIndex];
|
||||||
if (initialInputs !== null) {
|
if (initialInputs !== null) {
|
||||||
const setInput = def.setInput;
|
const setInput = def.setInput;
|
||||||
|
|
|
@ -603,7 +603,7 @@ export interface TProjectionNode extends TNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An union type representing all TNode types that can host a directive.
|
* A union type representing all TNode types that can host a directive.
|
||||||
*/
|
*/
|
||||||
export type TDirectiveHostNode = TElementNode | TContainerNode | TElementContainerNode;
|
export type TDirectiveHostNode = TElementNode | TContainerNode | TElementContainerNode;
|
||||||
|
|
||||||
|
|
|
@ -533,12 +533,6 @@
|
||||||
{
|
{
|
||||||
"name": "objectToClassName"
|
"name": "objectToClassName"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "postProcessBaseDirective"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "postProcessDirective"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "refreshChildComponents"
|
"name": "refreshChildComponents"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue