[Rd] RE: [R] ^ operation much slower in R 1.7.1 than in R 1.7.0
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Aug 5 13:07:18 MEST 2003
On Tue, 5 Aug 2003, Philippe Grosjean wrote:
> OK. Now I have compiled R 1.7.1 myself on my Windows XP pro computer with
> the recommended tools and MingW 2.0.0-3.
> Here is what I got:
> a <- abs(matrix(rnorm(800*800)/2, ncol=800, nrow=800))
> system.time(b <- a^1000)
> R 1.7.0 : 1.00 sec
> R 1.7.1 (from CRAN): 4.59 sec
> R 1.7.1 (custom) : 0.99 sec
> phi <- 1.6180339887498949
> a <- floor(runif(750000)*1000)
> system.time(b <- (phi^a - (-phi)^(-a))/sqrt(5))
> R 1.7.0 : 0.90 sec
> R 1.7.1 (from CRAN): 11.80 sec
> R 1.7.1 (custom) : 1.08 sec
> It seems thus that the problem originates in the Windows compilation of the
For whom is this a `problem'? A lot more than 10 secs has been spent on
> CRAN version of R 1.7.1. We will wait Duncan Murdoch for some more
> explanation. I cannot place the custom rw1071.exe on my web site because it
> is too large (almost 22 Mb). For the moment, you should recompile from
> source by yourself to get top speed in R 1.7.1.
*On this one operation*: we don't know that others may be faster or more
accurate on the CRAN version, nor how different chips compare.
You too have not told us exactly what setup you used, and FWIW when I
compile 1.7.0 myself I get the slow speed (using MinGW 3.0.0 rc3). I
suspect the difference is due to the use of a later version of
mingw-runtime, and that the later routines are slower but more accurate.
(Looks like mingw-runtime-2.2 used pow from msvcrt.dll, and -2.4/-3.0 have
2002-10-07 Danny Smith <dannysmith at users.sourceforge.net>
* mingwex/math/pow.c: New file.
He presumably had good reasons for doing that.)
Your conclusion seems unsubstantiated by your evidence. Something like
`if you are using Windows and ^ dominates the timings of your code, you
may want to try re-compiling using mingw-runtime-2.2'
seems the only valid conclusion.
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 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel