[R-SIG-Mac] Perplexed benchmark result from a new Macbook Pro Core i5

Gardar Johannesson gardarj at me.com
Sat May 8 20:53:31 CEST 2010


I was just replacing a Macbook Pro from 2008 (with a 2.2GHz Intel Core 2 Duo) with a new Macbook Pro (with a 2.4GHz Intel Core i5). To get a rough idea about the difference in R execution speed I ran a small test, with the output shown below. In short:

1) The new Macbook Pro was ca 60% _slower_ at linear algebra (crossprod() and solve())
2) The new Macbook Pro was ca 17% faster on a long for-loop
3) Linking against Goto2 versus vecLib improved the linear algebra results slightly

Both test were done using the same 2.11.0 dmg image from CRAN. 

Any thoughts on this? 

Any ideas how I can improve the performance results? What about compiling from source?


Thanks,
Gardar Johannesson


###########################################
## Results from new macbook pro (Core i5 @ 2.4Ghz)

> set.seed(1)
> A <- matrix(rnorm(2000*2000),2000,2000)
> system.time(B <- crossprod(A))
   user  system elapsed 
  2.500   0.058   0.816 
> system.time(B <- crossprod(A))
   user  system elapsed 
  2.502   0.050   0.814 
> system.time(solve(B))
   user  system elapsed 
  7.208   0.265   2.740 
> system.time(solve(B))
   user  system elapsed 
  7.121   0.264   2.666 
> system.time({a <- rep(1.0,100); for(i in 1:1e6) a <- 1.0*a+0.0})
   user  system elapsed 
  2.964   0.602   3.528 
> system.time({a <- rep(1.0,100); for(i in 1:1e6) a <- 1.0*a+0.0})
   user  system elapsed 
  3.040   0.732   3.732 
> sessionInfo()
R version 2.11.0 (2010-04-22) 
i386-apple-darwin9.8.0 

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_2.11.0
> 

###################################################
## Results from old macbook pro (Core 2 Duo @ 2.2GHz)

> set.seed(1)
> A <- matrix(rnorm(2000*2000),2000,2000)
> system.time(B <- crossprod(A))
   user  system elapsed 
  1.429   0.073   0.800 
> system.time(B <- crossprod(A))
   user  system elapsed 
  1.429   0.064   0.874 
> system.time(solve(B))
   user  system elapsed 
  4.532   0.285   2.860 
> system.time(solve(B))
   user  system elapsed 
  4.521   0.281   2.834 
> system.time({a <- rep(1.0,100); for(i in 1:1e6) a <- 1.0*a+0.0})
   user  system elapsed 
  3.501   0.764   4.215 
> system.time({a <- rep(1.0,100); for(i in 1:1e6) a <- 1.0*a+0.0})
   user  system elapsed 
  3.459   0.702   4.113 
> sessionInfo()
R version 2.11.0 (2010-04-22) 
i386-apple-darwin9.8.0 

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
> 


###################################################
## Results from new macbook pro (Core i5 @ 2.4Ghz)
## Linking against Goto2 BLAS (vs vecLib)

> set.seed(1)
> A <- matrix(rnorm(2000*2000),2000,2000)
> system.time(B <- crossprod(A))
   user  system elapsed 
  2.348   0.124   0.635 
> system.time(B <- crossprod(A))
   user  system elapsed 
  2.342   0.110   0.622 
> system.time(solve(B))
   user  system elapsed 
  6.634   0.327   2.158 
> system.time(solve(B))
   user  system elapsed 
  6.697   0.348   2.034 
> system.time({a <- rep(1.0,100); for(i in 1:1e6) a <- 1.0*a+0.0})
   user  system elapsed 
  2.577   0.548   2.885 
> system.time({a <- rep(1.0,100); for(i in 1:1e6) a <- 1.0*a+0.0})
   user  system elapsed 
  2.411   0.478   2.859 
> sessionInfo()
R version 2.11.0 (2010-04-22) 
i386-apple-darwin9.8.0 

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8



More information about the R-SIG-Mac mailing list