[Rd] Couldn't (and shouldn't) is.unsorted() be faster?

Herve Pages hpages at fhcrc.org
Thu Apr 17 21:04:50 CEST 2008


Hi,

Couldn't is.unsorted() bail out immediately here (after comparing
the first 2 elements):

 > x <- 20000000:1
 > system.time(is.unsorted(x), gcFirst=TRUE)
    user  system elapsed
   0.084   0.040   0.124

 > x <- 200000000:1
 > system.time(is.unsorted(x), gcFirst=TRUE)
    user  system elapsed
   0.772   0.440   1.214

Thanks!
H.



More information about the R-devel mailing list