A somewhat outdated comparison of Matlab and R (and a variety of other packages) can be found here. Unfortunately the R code is
too outdated to run with the current (2.8.1) version but you can find a more up to date version here.
I've added five statistical functions tests to the benchmark. The Matlab code is here and the R code is here.
Set up
Each test was run twenty times on a Intel Core 2 1.86Ghz machine with 4Gb RAM running Windows Vista Business. I increased the number of repeats from three to twenty since most of the calculations
rely on random numbers which will be different in each program. A much better solution for the matrix calculations would be to use the same randomly generated matrices in
each program, maybe I'll do that sometime!
I was using Matlab 2008b and R 2.8.0.
What conclusions can we draw?
Matlab is still on an order of twice as fast as R for Matrix operations. Also, Matlab can sometimes workout how to vectorise loops - which is why the loop test here concludes that Matlab is 400 times faster than R! I should really write a new loop test that Matlab isn't able to vectorise! For statistical functions it is less clear cut.
Naturally, speed is not necessarily a key consideration. We'd all be using C if it was after all. Personally, I prefer R's flexible plotting, rich data structures, package management and free-ness. But I'll admit it's far from perfect. But I'll admit it's far from perfect, and Matlab does have a lot of great features (like the profiler) and clean syntax.
I. Matrix calculation
R (sec)
Matlab (sec)
R/Matlab
Creation, transp., deformation of a 1500x1500 matrix