From 2545445ffb328c4cd1675a788019cd498ceb1d58 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 14 May 2019 21:34:47 -0700 Subject: [PATCH] perf(ivy): extract multiple reads to local var (#30453) PR Close #30453 --- packages/core/src/render3/instructions/element.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/core/src/render3/instructions/element.ts b/packages/core/src/render3/instructions/element.ts index a288211792..ab7a79a4fe 100644 --- a/packages/core/src/render3/instructions/element.ts +++ b/packages/core/src/render3/instructions/element.ts @@ -78,12 +78,13 @@ export function ɵɵelementStart( // instantiated into a context per element) setNodeStylingTemplate(tView, tNode, attrs, lastAttrIndex); - if (tNode.stylingTemplate) { + const stylingTemplate = tNode.stylingTemplate; + if (stylingTemplate) { // the initial style/class values are rendered immediately after having been // initialized into the context so the element styling is ready when directives // are initialized (since they may read style/class values in their constructor) - initialStylesIndex = renderInitialStyles(native, tNode.stylingTemplate, renderer); - initialClassesIndex = renderInitialClasses(native, tNode.stylingTemplate, renderer); + initialStylesIndex = renderInitialStyles(native, stylingTemplate, renderer); + initialClassesIndex = renderInitialClasses(native, stylingTemplate, renderer); } }