]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
perf(runtime-core): use faster diff map population (#319)
authorCarlos Rodrigues <david-181@hotmail.com>
Wed, 16 Oct 2019 19:34:51 +0000 (20:34 +0100)
committerEvan You <yyx990803@gmail.com>
Wed, 16 Oct 2019 19:34:51 +0000 (15:34 -0400)
packages/runtime-core/src/createRenderer.ts

index 3dabb11e2e31bc58b9a5d847958318ecb0dbb747..d2dd89afce28684e696d4378f588079d3905fd06 100644 (file)
@@ -1502,8 +1502,8 @@ export function createRenderer<
       // and oldIndex = 0 is a special value indicating the new node has
       // no corresponding old node.
       // 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++) {
         const prevChild = c1[i]