Fast parallel sort
fsort.Rd
Similar to base::sort
but fast using parallelism. Experimental.
Arguments
- x
A vector. Type double, currently.
- decreasing
Decreasing order?
- na.last
Control treatment of
NA
s. IfTRUE
, missing values in the data are put last; ifFALSE
, they are put first; ifNA
, they are removed; if"keep"
they are kept with rankNA
.- internal
Internal use only. Temporary variable. Will be removed.
- verbose
Print tracing information.
- ...
Not sure yet. Should be consistent with base R.
Details
Process will raise error if x
contains negative values.
Unless x
is already sorted fsort
will redirect processing to slower single threaded order followed by subset in following cases:
data type other than double (numeric)
data having
NA
sdecreasing==FALSE
Examples
x = runif(1e6)
system.time(ans1 <- sort(x, method="quick"))
#> user system elapsed
#> 0.109 0.001 0.111
system.time(ans2 <- fsort(x))
#> user system elapsed
#> 0.027 0.002 0.028
identical(ans1, ans2)
#> [1] TRUE