[R-SIG-Mac] Poor Performance of R for Mac as distributed on the developer's page

Simon Urbanek simon.urbanek at r-project.org
Mon Jan 10 18:58:58 CET 2011

On Jan 10, 2011, at 12:25 PM, Yan Zhou wrote:

> Dear all,
> I have been using the stable branch (i.e. 2.12-branch patched for now) downloaded from http://r.urbanek.info/ for quite a long time.  The binary is compiled on Mac OS X 10.5 as said on the webpage. Just for curiousness I tried to build R on my laptop today and got some surprising result about the performance.
> The benchmark is R-benchmark-25.R on http://r.urbanek.info/benchmarks/
> For a complete log see the end of this email.
> The laptop used for testing is a mid-2010 macbook pro 15", with core i7 2.66GHz, 8GB memory, Mac OS X 10.6
> Two versions of R are tested, one is the binary downloaded from http://r.urbanek.info/, R 2.12.1 patched (2011-01-08). 
> The other is build from source. The source is checked out from SVN repository, 2.12-branch, revision 53948 (https://svn.r-project.org/R/branches/R-2-12-branch/). The building is almost the same as described on http://r.urbanek.info/building.html, except that gfortran is replaced by intel ifort and only x86_64 version is build rather than a universal binary. Blas and lapack are linked to vecLib (--with-blas='-framework vecLib' --with-lapack). The build passed "make check" successfully.
> Comparing the benchmarks result. The binary distributed from http://r.urbanek.info/ is much slower than the one build from source for  cross-product (10 times slower) and linear regression, determinant, Cholesky decomposition, inverse of matrix (roughly 5 times slower). Other things are almost the same or only slightly slower.
> I thought all these tasks are performed by blas/lapack and both versions are linked to vecLib.

No, they are not. We do provide both options - you can switch it by changing the libRblas.dylib symlink as mentioned in the docs - but the default has been changed to use R's BLAS due to the issues vecLib has on recent Apple hardware (most notably Mac Pros). Since you're using only an i7 and not a Xeon you are not hit by the bug in OS X and thus  for you vecLib will be faster - see the recent discussion here.

> So I cannot understand the difference in performance. I doubt that it has anything to do with the use of ifort. It would be highly appreciated if someone could explain this to me. In addition I think both R are dynamically linked to the veclib as installed on my mac, the fact the the binary distributed on web is build on mac os x 10.5 should have little to do with this. Correct me on this if I am wrong.

I'm doing so herewith ;). But you should really check it for yourself with

ls -l /Library/Frameworks/R.framework/Resources/lib/libRblas.dylib

if it points to libRblas.0.dylib then you're using R BLAS, if it points to libRblas.vecLib.dylib you're using vecLib.


> Now the complete log of the two benchmarks.
> [....]

More information about the R-SIG-Mac mailing list