Skip to content
Permalink
Browse files

perf(ivy): remove repeated memory read / write in addComponentLogic (#…

…32339)

PR Close #32339
  • Loading branch information...
pkozlowski-opensource authored and mhevery committed Aug 27, 2019
1 parent 60a056d commit 581b837e88e4fb70acb888f9308cb0869c830372
Showing with 5 additions and 7 deletions.
  1. +5 −7 packages/core/src/render3/instructions/shared.ts
@@ -1321,19 +1321,17 @@ function baseResolveDirective<T>(tView: TView, viewData: LView, def: DirectiveDe
}

function addComponentLogic<T>(lView: LView, hostTNode: TNode, def: ComponentDef<T>): void {
const native = getNativeByTNode(hostTNode, lView);
const native = getNativeByTNode(hostTNode, lView) as RElement;
const tView = getOrCreateTView(def);

// Only component views should be added to the view tree directly. Embedded views are
// accessed through their containers because they may be removed / re-added later.
const rendererFactory = lView[RENDERER_FACTORY];
const componentView = addToViewTree(
lView, createLView(
lView, tView, null, def.onPush ? LViewFlags.Dirty : LViewFlags.CheckAlways,
lView[hostTNode.index], hostTNode as TElementNode, rendererFactory,
rendererFactory.createRenderer(native as RElement, def)));

componentView[T_HOST] = hostTNode as TElementNode;
lView,
createLView(
lView, tView, null, def.onPush ? LViewFlags.Dirty : LViewFlags.CheckAlways, native,
hostTNode as TElementNode, rendererFactory, rendererFactory.createRenderer(native, def)));

// Component view will always be created before any injected LContainers,
// so this is a regular element, wrap it with the component view

0 comments on commit 581b837

Please sign in to comment.
You can’t perform that action at this time.