Skip to content

Commit 1ececdd

Browse files
committed
Lower threshold on Array sort
1 parent aec0bc1 commit 1ececdd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/Runtime/Library/JsBuiltIn/JsBuiltIn.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@
276276
}
277277

278278
// for short arrays perform an insertion sort
279-
if (length < 2048) {
279+
if (length < 1024) {
280280
let sortedCount = 1, lowerBound = 0, insertPoint = 0, upperBound = 0;
281281
while (sortedCount < length) {
282282
const item = o[sortedCount];

test/Array/array_sort_random.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ function stressTestSort(iterations, size = 1000)
163163
}
164164
}
165165

166-
// test arrays with length < 2048 for insertion sort
167-
stressTestSort(200, 512);
168-
// test arrays with length > 2048 for merge sort
169-
stressTestSort(200, 2050);
166+
// test arrays with length < 1024 for insertion sort
167+
stressTestSort(100, 512);
168+
// test arrays with length > 1024 for merge sort
169+
stressTestSort(100, 1025);
170170

171171
print("PASS");

0 commit comments

Comments
 (0)