[R] Unusual slowing of R matrix multiplication version 2.12.1 (2010-10-15) vs 2.12.0
Joseph Kunkel
joe at bio.umass.edu
Mon Feb 7 19:13:49 CET 2011
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
More information about the R-help
mailing list