[R] Benchmarking R, why sort() is so slow?

Torsten Hothorn Torsten.Hothorn at rzmail.uni-erlangen.de
Fri Apr 27 14:55:13 CEST 2001


> Hello everybody,
> 
> I am making a modified version of "Stephan Steinhaus' benchmark test for
> number crunching, v. 2, (see
> http://www.scinetificweb.com/ncrunch/ncrunch.pdf for the original version),
> comparing several functions of some math/stat software. R is not performing
> bad at all... except for the sorting of a 1,100,000 random vector (test #3)
> which is the worst of all (see cell F3 in the following table). I simply
> used the sort() function. Does anybody has an explanation for that?

it seems to depend:

R> x <- rnorm(1100000)
R> Rprof("sort.out")
R> b <- sort(x)

needs

hothorn at artemis:~ > R CMD Rprof sort.out 

Each sample represents 0.02 seconds.
Total run time: 24.9399999999996 seconds.

but

R> x <- sample(1:100, 1100000, T)
R> Rprof("sort3.out")
R> b <- sort(x)

needs

hothorn at artemis:~ > R CMD Rprof sort3.out  

Each sample represents 0.02 seconds.
Total run time: 4.2 seconds.

on a Intel PIII 450 MHz, 256 MB, SuSE Linux 6.3, R-1.2.3

Torsten

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list