From 4d32917a43d00fb091a61241b98bd0a3db56ceec Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Wed, 2 Sep 2020 15:00:50 +0100 Subject: [PATCH] Differ: Skip unnecessary array copy --- src/treeDiffer.Differ.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/treeDiffer.Differ.js b/src/treeDiffer.Differ.js index 46fc93b..9606fbe 100644 --- a/src/treeDiffer.Differ.js +++ b/src/treeDiffer.Differ.js @@ -237,7 +237,9 @@ treeDiffer.Differ.prototype.findMinimumTransactions = function ( keyRoot1, keyRo } } - this.transactions[ i ][ j ] = transactions[ i ][ j ].slice(); + // No need to do a shallow copy here as transactions[ i ][ j ] and + // this.transactions[ i ][ j ] will never be changed again after this line. + this.transactions[ i ][ j ] = transactions[ i ][ j ]; } else { // Previous transactions, leading up to a remove, insert or change