Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7Rercfj3dzDQowoFA
22 lines
902 B
Plaintext
22 lines
902 B
Plaintext
What Arrays.sort really does (read from this JDK's lib/src.zip)
|
|
===============================================================
|
|
|
|
JDK: 25.0.5.1+2-LTS
|
|
|
|
java/util/Arrays.java:
|
|
99 DualPivotQuicksort.sort(a, 0, 0, a.length);
|
|
1034 public static void sort(Object[] a) {
|
|
1223 public static <T> void sort(T[] a, Comparator<? super T> c) {
|
|
1038 ComparableTimSort.sort(a, 0, a.length, null, 0, 0); (inside sort(Object[]))
|
|
lines in Arrays.java that call TimSort.sort(: 8
|
|
|
|
java/util/DualPivotQuicksort.java, the constants and the fallback:
|
|
69 private static final int MAX_INSERTION_SORT_SIZE = 44;
|
|
64 private static final int MAX_MIXED_INSERTION_SORT_SIZE = 65;
|
|
119 private static final int DELTA = 3 << 1;
|
|
124 private static final int MAX_RECURSION_DEPTH = 64 * DELTA;
|
|
285 if ((bits += DELTA) > MAX_RECURSION_DEPTH) {
|
|
286 heapSort(a, low, high);
|
|
287 return;
|
|
288 }
|