[R] R/octave/matlab etc.

Denney, William S. william_denney at merck.com
Mon Jan 5 15:20:26 CET 2009


Hello,

I don't think that the large disparity in loop performance between
Matlab, R, and Octave is explained by compilation time performance
settings.  For Octave, it is well known that loops perform poorly
relative to Matlab (though many other operations perform better).  The
reason is that Matlab has the just in time (JIT) compiler, and it is
responsible for almost all of the loop speed advantage.

Have a good day,

Bill

-----Original Message-----
From: John C Nash [mailto:nashjc at uottawa.ca] 
Sent: Sunday, January 04, 2009 1:51 PM
To: r-help at r-project.org
Subject: [R] R/octave/matlab etc.

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


Notice:  This e-mail message, together with any attachme...{{dropped:12}}




More information about the R-help mailing list