mirror of
https://gitlab.uni-marburg.de/langbeid/powersort.git
synced 2025-01-21 19:50:35 +01:00
FasterFinnSort: stackLen calculation
This commit is contained in:
parent
1fb89e8985
commit
959cb20e7b
@ -171,23 +171,8 @@ public class FasterFinnSort<T> {
|
|||||||
tmpLen = workLen;
|
tmpLen = workLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// TODO: Verify if this is correct
|
||||||
* Allocate runs-to-be-merged stack (which cannot be expanded). The
|
int stackLen = ((int) Math.ceil(Math.log(rangeSize))) + 2;
|
||||||
* stack length requirements are described in listsort.txt. The C
|
|
||||||
* version always uses the same stack length (85), but this was
|
|
||||||
* measured to be too expensive when sorting "mid-sized" arrays (e.g.,
|
|
||||||
* 100 elements) in Java. Therefore, we use smaller (but sufficiently
|
|
||||||
* large) stack lengths for smaller arrays. The "magic numbers" in the
|
|
||||||
* computation below must be changed if MIN_MERGE is decreased. See
|
|
||||||
* the MIN_MERGE declaration above for more information.
|
|
||||||
* The maximum value of 49 allows for an array up to length
|
|
||||||
* Integer.MAX_VALUE-4, if array is filled by the worst case stack size
|
|
||||||
* increasing scenario. More explanations are given in section 4 of:
|
|
||||||
* http://envisage-project.eu/wp-content/uploads/2015/02/sorting.pdf
|
|
||||||
*/
|
|
||||||
int stackLen = (len < 120 ? 5 :
|
|
||||||
len < 1542 ? 10 :
|
|
||||||
len < 119151 ? 24 : 49);
|
|
||||||
runBase = new int[stackLen];
|
runBase = new int[stackLen];
|
||||||
runLen = new int[stackLen];
|
runLen = new int[stackLen];
|
||||||
runPower = new int[stackLen];
|
runPower = new int[stackLen];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user