[R] R/octave/matlab etc.

luke at stat.uiowa.edu luke at stat.uiowa.edu
Mon Jan 5 15:54:54 CET 2009


It is the_vectorized_ performance differences that may be in part
explained by compiler settings.  The interpreter overhead (not just
loops) is not.

luke

On Mon, 5 Jan 2009, Denney, William S. wrote:

> 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}}
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu




More information about the R-help mailing list