*** /Users/bchristi/WS/14dualPivot/jdk/open/src/java.base/share/classes/java/util/DualPivotQuicksort.java 2019-08-02 13:03:36.000000000 -0700 --- ./FILES/DualPivotQuicksort.java 2019-08-12 13:32:18.000000000 -0700 *************** *** 58,69 **** /** * Max array size to use mixed insertion sort. */ ! private static final int MAX_MIXED_INSERTION_SORT_SIZE = 114; /** * Max array size to use insertion sort. */ ! private static final int MAX_INSERTION_SORT_SIZE = 41; /** * Min array size to perform sorting in parallel. --- 58,69 ---- /** * Max array size to use mixed insertion sort. */ ! private static final int MAX_MIXED_INSERTION_SORT_SIZE = 65; /** * Max array size to use insertion sort. */ ! private static final int MAX_INSERTION_SORT_SIZE = 44; /** * Min array size to perform sorting in parallel. *************** *** 111,119 **** private static final int MIN_SHORT_OR_CHAR_COUNTING_SORT_SIZE = 1750; /** ! * Max double recursive partitioning depth before using heap sort. */ ! private static final int MAX_RECURSION_DEPTH = 64 << 1; /** * Calculates the double depth of parallel merging. --- 111,124 ---- private static final int MIN_SHORT_OR_CHAR_COUNTING_SORT_SIZE = 1750; /** ! * Threshold of mixed insertion sort is incremented by this value. */ ! private static final int DELTA = 3 << 1; ! ! /** ! * Max recursive partitioning depth before using heap sort. ! */ ! private static final int MAX_RECURSION_DEPTH = 64 * DELTA; /** * Calculates the double depth of parallel merging. *************** *** 177,183 **** /* * Run mixed insertion sort on small non-leftmost parts. */ ! if (size < MAX_MIXED_INSERTION_SORT_SIZE && (bits & 1) > 0) { mixedInsertionSort(a, low, high - 3 * ((size >> 5) << 3), high); return; } --- 182,188 ---- /* * Run mixed insertion sort on small non-leftmost parts. */ ! if (size < MAX_MIXED_INSERTION_SORT_SIZE + bits && (bits & 1) > 0) { mixedInsertionSort(a, low, high - 3 * ((size >> 5) << 3), high); return; } *************** *** 203,209 **** * Switch to heap sort if execution * time is becoming quadratic. */ ! if ((bits += 2) > MAX_RECURSION_DEPTH) { heapSort(a, low, high); return; } --- 208,214 ---- * Switch to heap sort if execution * time is becoming quadratic. */ ! if ((bits += DELTA) > MAX_RECURSION_DEPTH) { heapSort(a, low, high); return; } *************** *** 931,937 **** /* * Run mixed insertion sort on small non-leftmost parts. */ ! if (size < MAX_MIXED_INSERTION_SORT_SIZE && (bits & 1) > 0) { mixedInsertionSort(a, low, high - 3 * ((size >> 5) << 3), high); return; } --- 936,942 ---- /* * Run mixed insertion sort on small non-leftmost parts. */ ! if (size < MAX_MIXED_INSERTION_SORT_SIZE + bits && (bits & 1) > 0) { mixedInsertionSort(a, low, high - 3 * ((size >> 5) << 3), high); return; } *************** *** 957,963 **** * Switch to heap sort if execution * time is becoming quadratic. */ ! if ((bits += 2) > MAX_RECURSION_DEPTH) { heapSort(a, low, high); return; } --- 962,968 ---- * Switch to heap sort if execution * time is becoming quadratic. */ ! if ((bits += DELTA) > MAX_RECURSION_DEPTH) { heapSort(a, low, high); return; } *************** *** 1770,1776 **** * Switch to counting sort if execution * time is becoming quadratic. */ ! if ((bits += 2) > MAX_RECURSION_DEPTH) { countingSort(a, low, high); return; } --- 1775,1781 ---- * Switch to counting sort if execution * time is becoming quadratic. */ ! if ((bits += DELTA) > MAX_RECURSION_DEPTH) { countingSort(a, low, high); return; } *************** *** 2089,2095 **** * Switch to counting sort if execution * time is becoming quadratic. */ ! if ((bits += 2) > MAX_RECURSION_DEPTH) { countingSort(a, low, high); return; } --- 2094,2100 ---- * Switch to counting sort if execution * time is becoming quadratic. */ ! if ((bits += DELTA) > MAX_RECURSION_DEPTH) { countingSort(a, low, high); return; } *************** *** 2472,2478 **** /* * Run mixed insertion sort on small non-leftmost parts. */ ! if (size < MAX_MIXED_INSERTION_SORT_SIZE && (bits & 1) > 0) { mixedInsertionSort(a, low, high - 3 * ((size >> 5) << 3), high); return; } --- 2477,2483 ---- /* * Run mixed insertion sort on small non-leftmost parts. */ ! if (size < MAX_MIXED_INSERTION_SORT_SIZE + bits && (bits & 1) > 0) { mixedInsertionSort(a, low, high - 3 * ((size >> 5) << 3), high); return; } *************** *** 2498,2504 **** * Switch to heap sort if execution * time is becoming quadratic. */ ! if ((bits += 2) > MAX_RECURSION_DEPTH) { heapSort(a, low, high); return; } --- 2503,2509 ---- * Switch to heap sort if execution * time is becoming quadratic. */ ! if ((bits += DELTA) > MAX_RECURSION_DEPTH) { heapSort(a, low, high); return; } *************** *** 3278,3284 **** /* * Run mixed insertion sort on small non-leftmost parts. */ ! if (size < MAX_MIXED_INSERTION_SORT_SIZE && (bits & 1) > 0) { mixedInsertionSort(a, low, high - 3 * ((size >> 5) << 3), high); return; } --- 3283,3289 ---- /* * Run mixed insertion sort on small non-leftmost parts. */ ! if (size < MAX_MIXED_INSERTION_SORT_SIZE + bits && (bits & 1) > 0) { mixedInsertionSort(a, low, high - 3 * ((size >> 5) << 3), high); return; } *************** *** 3304,3310 **** * Switch to heap sort if execution * time is becoming quadratic. */ ! if ((bits += 2) > MAX_RECURSION_DEPTH) { heapSort(a, low, high); return; } --- 3309,3315 ---- * Switch to heap sort if execution * time is becoming quadratic. */ ! if ((bits += DELTA) > MAX_RECURSION_DEPTH) { heapSort(a, low, high); return; }