|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jsr166y.ForkJoinTask<java.lang.Void> jsr166y.RecursiveAction groovyx.gpars.extra166y.PAS.FJOSorter
static final class PAS.FJOSorter
Sorter classes based mainly on CilkSort Cilk: Basic algorithm: if array size is small, just use a sequential quicksort Otherwise: 1. Break array in half. 2. For each half, a. break the half in half (i.e., quarters), b. sort the quarters c. merge them together 3. merge together the two halves. One reason for splitting in quarters is that this guarantees that the final sort is in the main array, not the workspace array. (workspace and main swap roles on each subsort step.) Leaf-level sorts use a Sequential quicksort, that in turn uses insertion sort if under threshold. Otherwise it uses median of three to pick pivot, and loops rather than recurses along left path. It is sad but true that sort and merge performance are sensitive enough to inner comparison overhead to warrant creating 6 versions (not just 3) -- one each for natural comparisons vs supplied comparators.
Field Summary | |
---|---|
(package private) java.lang.Object[] |
a
|
(package private) java.util.Comparator |
cmp
|
(package private) int |
gran
|
(package private) int |
n
|
(package private) int |
origin
|
(package private) java.lang.Object[] |
w
|
Constructor Summary | |
---|---|
PAS.FJOSorter(java.util.Comparator cmp,
java.lang.Object[] a,
java.lang.Object[] w,
int origin,
int n,
int gran)
|
Method Summary | |
---|---|
void |
compute()
|
Methods inherited from class jsr166y.RecursiveAction |
---|
exec, getRawResult, setRawResult |
Methods inherited from class jsr166y.ForkJoinTask |
---|
adapt, adapt, adapt, cancel, complete, completeExceptionally, fork, get, get, getException, getPool, getQueuedTaskCount, getSurplusQueuedTaskCount, helpQuiesce, inForkJoinPool, invoke, invokeAll, invokeAll, invokeAll, isCancelled, isCompletedAbnormally, isCompletedNormally, isDone, join, peekNextLocalTask, pollNextLocalTask, pollTask, quietlyInvoke, quietlyJoin, reinitialize, tryUnfork |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
final java.util.Comparator cmp
final java.lang.Object[] a
final java.lang.Object[] w
final int origin
final int n
final int gran
Constructor Detail |
---|
PAS.FJOSorter(java.util.Comparator cmp, java.lang.Object[] a, java.lang.Object[] w, int origin, int n, int gran)
Method Detail |
---|
public void compute()
compute
in class jsr166y.RecursiveAction
|
Copyright © 2008–2012 Václav Pech. All Rights Reserved. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |