[R] Why R is 200 times slower than Matlab ?

Gabor Csardi csardi at rmki.kfki.hu
Wed Apr 30 22:29:55 CEST 2008


I would rather not comment on matlab (where is
your matlab code by the way?), but your function
could be simplified a bit:

grw.permute <- function(v) {
  cbind( rep(v, each=length(v)), rep(v, length(v)) )
}

> system.time(tmp <- f( 1:300))
   user  system elapsed 
  0.020   0.000   0.019 

This is on my quite busy 4 years old laptop....

Best,
Gabor

On Wed, Apr 30, 2008 at 04:15:46PM -0400, Zhandong Liu wrote:
> I am switching from Matlab to R, but I found that R is 200 times slower than
> matlab.
> 
> Since I am newbie to R, I must be missing some important programming tips.
> 
[...]

-- 
Csardi Gabor <csardi at rmki.kfki.hu>    UNIL DGM



More information about the R-help mailing list