[R] How does R compares for speed?
Liaw, Andy
andy_liaw at merck.com
Wed Jun 12 14:50:22 CEST 2002
> From: Prof Brian D Ripley [mailto:ripley at stats.ox.ac.uk]
>
> On Wed, 12 Jun 2002, Philippe Grosjean wrote:
> > Hi,
> >
> > For those who are interested, I have update my R benchmark
> (to version
> > 1.5.0) and also to Splus 6. They are available at:
> > http://www.sciviews.org/other/benchmark.htm. A comparison
> is made between
> > Matlab (5.3 & 6), R 1.5.0, Splus 6 rel 2, O-Matrix 5.1,
> Octave 2.1.31,
> > Scilab 2.6, Rlab 2.1 and OX 3.00 under Windows 2000 pro.
> >
> > Overall, R is not the fastest package, but it is one of the
> fastest... and
> > comparison with Splus is interesting! Please, note that the
> benchmark tests
> > only a few function, and also gives no information about
> the "richness" or
> > "usability" of the various software tested. At least, it is
> interesting to
> > note that R is becoming more and more performant with versions: the
> > benchmark applied to previous versions of R identified some lacks in
> > performance, particularly in the sort() function, which now
> belong to the
> > past. Congratulation for all who contributed (and still
> contribute) to make
> > R one of the best statistical and "number crunching" system!!!
>
> I couldn't find any details of how you actually programmed
> the systems.
> For one example, there are many ways to do linear regression in R, and
> most of them give a lot more output than matrix languages. I suspect
> R and S-PLUS are slow on test I-E because they do more.
The scripts for the benchmark are actually on that web site. The regression
part is coded as:
a <- Rnorm(700*700); dim(a) <- c(700,700)
b <- 1:700
timing <- system.time({
qra <- qr(a, tol = 1e-7);
c <- qr.coef(qra, b)
#Rem: a little faster than c <- lsfit(a, b, inter=F)$coefficients
})[3]
For the timing on cross product, though, it's coded as crossprod(a, a), but
in R 1.5.0, crossprod(a) would have cut the time quite a bit. On my PIII
laptop (IBM Thinkpad T22) with R-1.5.0 linked against ATLAS:
> a <- matrix(rnorm(550*550), 550,550)
> system.time(crossprod(a,a))
[1] 0.67 0.00 0.69 NA NA
> system.time(crossprod(a))
[1] 0.32 0.00 0.47 NA NA
> system.time(crossprod(a,a))
[1] 0.53 0.02 0.55 NA NA
> system.time(crossprod(a))
[1] 0.32 0.00 0.33 NA NA
> system.time(crossprod(a,a))
[1] 0.53 0.00 0.53 NA NA
> system.time(crossprod(a))
[1] 0.30 0.00 0.33 NA NA
> system.time(crossprod(a,a))
[1] 0.53 0.00 0.53 NA NA
> system.time(crossprod(a))
[1] 0.32 0.00 0.32 NA NA
Cheers,
Andy
>
> --
> Brian D. Ripley, ripley at stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272860 (secr)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _._._._._._._._._
>
------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.
==============================================================================
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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