mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Only use SetCache in baseIntersection only when arrays[0] is large.
This commit is contained in:
@@ -2766,6 +2766,7 @@
|
|||||||
*/
|
*/
|
||||||
function baseIntersection(arrays, iteratee, comparator) {
|
function baseIntersection(arrays, iteratee, comparator) {
|
||||||
var includes = comparator ? arrayIncludesWith : arrayIncludes,
|
var includes = comparator ? arrayIncludesWith : arrayIncludes,
|
||||||
|
length = arrays[0].length,
|
||||||
othLength = arrays.length,
|
othLength = arrays.length,
|
||||||
othIndex = othLength,
|
othIndex = othLength,
|
||||||
caches = Array(othLength),
|
caches = Array(othLength),
|
||||||
@@ -2777,14 +2778,12 @@
|
|||||||
if (othIndex && iteratee) {
|
if (othIndex && iteratee) {
|
||||||
array = arrayMap(array, baseUnary(iteratee));
|
array = arrayMap(array, baseUnary(iteratee));
|
||||||
}
|
}
|
||||||
var length = array.length;
|
maxLength = nativeMin(array.length, maxLength);
|
||||||
maxLength = length < maxLength ? length : maxLength;
|
caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
|
||||||
caches[othIndex] = !comparator && (iteratee || length >= 120)
|
|
||||||
? new SetCache(othIndex && array)
|
? new SetCache(othIndex && array)
|
||||||
: undefined;
|
: undefined;
|
||||||
}
|
}
|
||||||
array = arrays[0];
|
array = arrays[0];
|
||||||
length = array.length;
|
|
||||||
|
|
||||||
var index = -1,
|
var index = -1,
|
||||||
seen = caches[0];
|
seen = caches[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user