From 53f33c1ceccdcfae31ce8807eec7aecf17f4f97b Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Mon, 19 Aug 2019 16:18:15 +0200 Subject: [PATCH] perf(ivy): read selected index only when need in prop bindings (#32212) PR Close #32212 --- packages/core/src/render3/instructions/property.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/core/src/render3/instructions/property.ts b/packages/core/src/render3/instructions/property.ts index 7c21e306c1..c242e88369 100644 --- a/packages/core/src/render3/instructions/property.ts +++ b/packages/core/src/render3/instructions/property.ts @@ -5,7 +5,6 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -import {assertNotEqual} from '../../util/assert'; import {bindingUpdated} from '../bindings'; import {SanitizerFn} from '../interfaces/sanitization'; import {BINDING_INDEX, LView} from '../interfaces/view'; @@ -35,12 +34,10 @@ import {TsickleIssue1009, elementPropertyInternal, storeBindingMetadata} from '. */ export function ɵɵproperty( propName: string, value: T, sanitizer?: SanitizerFn | null): TsickleIssue1009 { - const index = getSelectedIndex(); - ngDevMode && assertNotEqual(index, -1, 'selected index cannot be -1'); const lView = getLView(); const bindReconciledValue = bind(lView, value); if (bindReconciledValue !== NO_CHANGE) { - elementPropertyInternal(index, propName, bindReconciledValue, sanitizer); + elementPropertyInternal(getSelectedIndex(), propName, bindReconciledValue, sanitizer); } return ɵɵproperty; }