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

From: Gabor Csardi <csardi_at_rmki.kfki.hu>
Date: Wed, 30 Apr 2008 22:29:55 +0200

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

______________________________________________
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.
Received on Wed 30 Apr 2008 - 21:07:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 Apr 2008 - 21:30:42 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive