perf(ivy): clean up createNodeAtIndex for speed (#30453)

PR Close #30453
This commit is contained in:
Misko Hevery 2019-05-14 21:45:40 -07:00 committed by Jason Aden
parent 2545445ffb
commit 9ce9561737
1 changed files with 4 additions and 5 deletions

View File

@ -259,9 +259,9 @@ export function createNodeAtIndex(
lView[adjustedIndex] = native; lView[adjustedIndex] = native;
const previousOrParentTNode = getPreviousOrParentTNode(); const previousOrParentTNode = getPreviousOrParentTNode();
const isParent = getIsParent();
let tNode = tView.data[adjustedIndex] as TNode; let tNode = tView.data[adjustedIndex] as TNode;
if (tNode == null) { if (tNode == null) {
const isParent = getIsParent();
const parent = const parent =
isParent ? previousOrParentTNode : previousOrParentTNode && previousOrParentTNode.parent; isParent ? previousOrParentTNode : previousOrParentTNode && previousOrParentTNode.parent;
@ -282,10 +282,9 @@ export function createNodeAtIndex(
previousOrParentTNode.next = tNode; previousOrParentTNode.next = tNode;
} }
} }
} if (index === 0) {
tView.firstChild = tNode;
if (tView.firstChild == null) { }
tView.firstChild = tNode;
} }
setPreviousOrParentTNode(tNode); setPreviousOrParentTNode(tNode);