diff --git a/src/lib/search.js b/src/lib/search.js index 8fcc5ed9bb1..2d745cc9284 100644 --- a/src/lib/search.js +++ b/src/lib/search.js @@ -118,6 +118,10 @@ exports.roundUp = function(val, arrayIn, reverse) { /** * Tweak to Array.sort(sortFn) that improves performance for pre-sorted arrays * + * Note that newer browsers (such as Chrome v70+) are starting to pick up + * on pre-sorted arrays which may render the following optimization unnecessary + * in the future. + * * Motivation: sometimes we need to sort arrays but the input is likely to * already be sorted. Browsers don't seem to pick up on pre-sorted arrays, * and in fact Chrome is actually *slower* sorting pre-sorted arrays than purely diff --git a/test/jasmine/tests/lib_test.js b/test/jasmine/tests/lib_test.js index e4ed92e3a3c..3dde0f81c7a 100644 --- a/test/jasmine/tests/lib_test.js +++ b/test/jasmine/tests/lib_test.js @@ -2329,10 +2329,6 @@ describe('Test lib.js:', function() { .toEqual(dupes()); expect(callCount).toEqual(18); - - callCount = 0; - dupes().sort(sortCounter); - expect(callCount).toBeGreaterThan(18); }); it('still short-circuits reversed with duplicates', function() { @@ -2340,10 +2336,6 @@ describe('Test lib.js:', function() { .toEqual(dupes().reverse()); expect(callCount).toEqual(18); - - callCount = 0; - dupes().sort(sortCounterReversed); - expect(callCount).toBeGreaterThan(18); }); });