From c5b2ad1aca2b904b6c3def32bcee7382b764ed68 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Sat, 18 Jan 2020 14:39:15 -0500 Subject: [PATCH] Add fast path for array comparison if objects are equal --- modules/util/array.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/util/array.js b/modules/util/array.js index aab92222d..b653271da 100644 --- a/modules/util/array.js +++ b/modules/util/array.js @@ -1,6 +1,9 @@ // Returns true if a and b have the same elements at the same indices. export function utilArrayIdentical(a, b) { + // an array is always identical to itself + if (a === b) return true; + var i = a.length; if (i !== b.length) return false; while (i--) { @@ -146,4 +149,3 @@ export function utilArrayUniqBy(a, key) { return acc; }, []); } -