[Rd] RE: [R] ^ operation much slower in R 1.7.1 than in R 1.7.0
phgrosjean at sciviews.org
Tue Aug 5 14:41:10 MEST 2003
All R versions from 1.0 to 1.7.0 did a similar job here (of course, the
computer and OS matters, but considering relative results). And suddenly
1.7.1 is 5 to 10 times slower than all previous versions! This is not just a
question of 10 sec. I am not the kind of people to say, booarf! What's those
10 sec in my life? I am the kind of people to ask questions when such thing
happens. OK, I did not checked for accuracy (and I hope 'make check-all' did
some test for me). I do not know about this miraculous new algorithm that is
so accurate that it is worth performing the calculation 5 to 10 times slower
than the previous one. Sorry for my ignorance.
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
Sent: mardi 5 aout 2003 1:07
To: Philippe Grosjean
Cc: r-devel at stat.math.ethz.ch
Subject: RE: [Rd] RE: [R] ^ operation much slower in R 1.7.1 than in R
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
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
> 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