Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

It is no news that R’s default BLAS is much slower that other available BLAS implementations. In A trick to speed up R matrix calculation/ Yu-Sung Su recommends using the ATLAS BLAS which is available on CRAN. When I learned about the possible speed-up  a while ago I tried several BLAS libraries and I found that GotoBLAS2 was giving me the best performance among the open-source BLAS implementations. Today I decided to check once again how much it makes sense to replace R’s default BLAS library.

Here are some results from my Intel i7-620M laptop running Windows 7:

Speed up using MKL or GotoBLAS2 vs. R’s default BLAS

I used rbenchmark for the measurements with the default of 100 repetitions and I saved and reused the same matrix across all runs:

 A = matrix(rnorm(1000*1000),ncol=1000) benchmark(A %*% A) benchmark(svd(A)) 

### A %*% A

BLAS seconds  speed-up
MKL 31.65 7.16
GotoBLAS2 42.30 5.36
Default 226.53 1.00

### svd(A)

BLAS seconds  speed-up
MKL 317.61 12.52
GotoBLAS2 389.13 10.22
Default 3976.21 1.00

## Conclusion

If you are using R operations that rely on BLAS than you should always use a faster BLAS implementation. If you are using Windows, you can use the Rblas.dll from here or you try the Revolution R Community edition which comes with a MKL BLAS.