[R] Unusual slowing of R matrix multiplication version 2.12.1 (2010-10-15) vs 2.12.0

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Feb 8 08:09:02 CET 2011


You'll need to ask the person who built R (you haven't told us).  If 
this was a binary CRAN build, you are asked to discuss that only on 
R-sig-mac, and you will find plenty of discussion on that list's 
archives.  Note that

- this is Mac-specific (not mentioned in your subject line)
- it even depends on the chipset of the Macs in question.

On Mon, 7 Feb 2011, Joseph Kunkel wrote:

> R Version 2.12.1 (2010-10-15) vs 2.12.0 has slowed down 8 fold for 
> dual core and 17 fold for dual-core-dual-processor Macs.  I have 
> checked this result on 3 different macs using the following 
> R-script:
>
> Using Version 2.12.0 on a dual core dual processor Mac:
>> source("http://www.bio.umass.edu/biology/kunkel/pub/R/CuriousResult.R")
> matrix multiplication      43.543   1.308  14.788
> tcrossprod                 41.147   1.286  11.9
> transposition and reuse    40.407   3.525  43.606
> elementwise after reshape  21.474   1.828  23.124
> columnwise sapply          34.695   32.35  66.592
> for loop over columns      37.237   29.471 67.2
>
> On the same day upgrading to 2.12.1 on the same dual core dual 
> processor Mac:
>
>> source("http://www.bio.umass.edu/biology/kunkel/pub/R/CuriousResult.R")
> matrix multiplication     256.775   2.178 256.919
> tcrossprod                246.609   1.987 247.075
> transposition and reuse    39.622   4.602  43.883
> elementwise after reshape  21.017   2.343  23.258
> columnwise sapply    39.393  37.069  75.834
> for loop over columns      35.461  33.155  68.165
>
> It seems clear that the upgrade to 2.12.1 has resulted in matrix 
> multiplication using only one core.  Notice that the other 
> techniques that avoid matrix multiplication seem to stay the same 
> but the two approaches that use matrix multiply have degraded worse 
> than the expected loss of just 4 fold.  Is it possible that a 
> different matrix multiply library was used in changing from version 
> 2.12.0 to 2.12.1?
>
> Joe Kunkel
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
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-help mailing list