[R] R/octave/matlab etc.

John C Nash nashjc at uottawa.ca
Sun Jan 4 19:50:53 CET 2009


I'd echo a lot of what has been said about this by the folk who have 
been making R work so well. One of the main difficulties is that the 
environment of computations affects relative performance. e.g., what 
settings did a distro package builder choose. I note that my 3 GHz Dual 
Core machine running Ubuntu 8.04 gets

octave 3.0.0

octave:6>   tic; a = a + 1; toc
Elapsed time is 0.120027 seconds.

octave:16>   tic;  for i=1:1e7; a(i) = a(i) + 1; end;   toc;
Elapsed time is 238.311 seconds.


R2.8.1

 > a <- rep(1,10000000)
 > system.time(a <- a + 1)
   user  system elapsed
  0.080   0.064   0.146
 
 > system.time(for (i in 1:10000000) {a[i] <- a[i] + 1})
   user  system elapsed
 68.092   0.160  68.745
 >

R looks pretty good in this comparison. I suspect Ubuntu has a rather 
low optimization level or similar for octave.

As Jean G. has indicated, tests may measure the wrong sorts of things. 
Nonetheless, there is a value -- they can help us check that builds have 
been done with the right setup. And if we get very disparate performance 
on machines of supposedly similar capability, we may need to look into 
the awful details.

JN




More information about the R-help mailing list