Explorar o código

perf(runtime-core): use faster diff map population (#319)

Carlos Rodrigues %!s(int64=6) %!d(string=hai) anos
pai
achega
48b79d02e8
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      packages/runtime-core/src/createRenderer.ts

+ 2 - 2
packages/runtime-core/src/createRenderer.ts

@@ -1502,8 +1502,8 @@ export function createRenderer<
       // and oldIndex = 0 is a special value indicating the new node has
       // and oldIndex = 0 is a special value indicating the new node has
       // no corresponding old node.
       // no corresponding old node.
       // used for determining longest stable subsequence
       // used for determining longest stable subsequence
-      const newIndexToOldIndexMap = []
-      for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap.push(0)
+      const newIndexToOldIndexMap = new Array(toBePatched)
+      for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0
 
 
       for (i = s1; i <= e1; i++) {
       for (i = s1; i <= e1; i++) {
         const prevChild = c1[i]
         const prevChild = c1[i]