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

2008-05-01 Thread Shige Song
So RA has to be installed in "c:\program files\R\RXXX"? I have R installed on another partition, but RA failed to locate it. Shige On Thu, May 1, 2008 at 9:47 PM, Zhandong Liu <[EMAIL PROTECTED]> wrote: > Great. Thanks a lot. > ZD > > On Wed, Apr 30, 2008 at 7:31 PM, Nelson Castillo <[EMAIL PROT

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

2008-05-01 Thread Zhandong Liu
Great. Thanks a lot. ZD On Wed, Apr 30, 2008 at 7:31 PM, Nelson Castillo <[EMAIL PROTECTED]> wrote: > On Wed, Apr 30, 2008 at 6:27 PM, Gabor Grothendieck > <[EMAIL PROTECTED]> wrote: > > Aside from optiming your code by making use of R functions > > that use C underneath as much as possible the

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

2008-05-01 Thread Douglas Bates
On 5/1/08, Shige Song <[EMAIL PROTECTED]> wrote: > Will the use of jit improve performance of use contributed packages such as > lme4? Thanks. A technology like a byte-compiler or a just-in-time compiler will change the performance of interpreted code. It will not change the performance of compi

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

2008-05-01 Thread Paul Smith
On Thu, May 1, 2008 at 12:31 AM, Nelson Castillo <[EMAIL PROTECTED]> wrote: > > Aside from optiming your code by making use of R functions > > that use C underneath as much as possible the big difference > > between R and Matlab is Matlab's just-in-time compilation of > > code. When that wa

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

2008-05-01 Thread Shige Song
Will the use of jit improve performance of use contributed packages such as lme4? Thanks. Shige On Thu, May 1, 2008 at 7:31 AM, Nelson Castillo <[EMAIL PROTECTED]> wrote: > On Wed, Apr 30, 2008 at 6:27 PM, Gabor Grothendieck > <[EMAIL PROTECTED]> wrote: > > Aside from optiming your code by makin

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

2008-04-30 Thread Nelson Castillo
On Wed, Apr 30, 2008 at 6:27 PM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Aside from optiming your code by making use of R functions > that use C underneath as much as possible the big difference > between R and Matlab is Matlab's just-in-time compilation of > code. When that was introdu

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

2008-04-30 Thread Gabor Grothendieck
Aside from optiming your code by making use of R functions that use C underneath as much as possible the big difference between R and Matlab is Matlab's just-in-time compilation of code. When that was introduced in Matlab huge speedups of Matlab programs were noticeable. For R, there is a new pac

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

2008-04-30 Thread Ray Brownrigg
Ah, so the code is quite similar in MATLAB (and the *algorithm* is the same :-) ). The "Important programming tip" is that when converting from MATLAB to R, you shouldn't just 'translate' from MATLAB code to R code, you must reconsider the problem in the context of the R environment. This is v

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

2008-04-30 Thread Zhandong Liu
This is the missing Matlab code: function[fc_matrix]=grw_permute(fc_vector) n=length(fc_vector); fc_matrix=zeros(2,n^2); index=1; for i=1:n for j=1:n fc_matrix(index)=fc_vector(i); fc_matrix(index+1)=fc_vector(j); index=index+2; end end On Wed, Apr 30, 200

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

2008-04-30 Thread Ray Brownrigg
On Thu, 01 May 2008, 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. > > Please help me out on this. > > Here is the function: > ## make the full pair-wise per

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

2008-04-30 Thread Peter Dalgaard
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. Please help me out on this. Here is the function: ## make the full pair-wise permutation of a vector ## input_fc=c

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

2008-04-30 Thread Gabor Csardi
But please consider that this benchmark is five years old, and i believe that R has changed quite a lot since version 1.9. Gabor On Wed, Apr 30, 2008 at 04:21:51PM -0400, Wensui Liu wrote: > Hi, ZD, > Your comment about speed is too general. Here is a benchmark > comparison among several langua

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

2008-04-30 Thread Erik Iverson
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. The most important tip I would give you is to use the vectorized nature of R whenever possible. This helps avo

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

2008-04-30 Thread jim holtman
You just have to use the right functions: is this fast enough > system.time(x <- expand.grid(1:300, 1:300)) user system elapsed 0.000.010.01 On Wed, Apr 30, 2008 at 4:15 PM, Zhandong Liu <[EMAIL PROTECTED]> wrote: > I am switching from Matlab to R, but I found that R is 200 times

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

2008-04-30 Thread Gabor Csardi
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

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

2008-04-30 Thread Wensui Liu
Hi, ZD, Your comment about speed is too general. Here is a benchmark comparison among several languages and HTH. http://www.sciviews.org/benchmark/index.html On Wed, Apr 30, 2008 at 4:15 PM, Zhandong Liu <[EMAIL PROTECTED]> wrote: > I am switching from Matlab to R, but I found that R is 200 times

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

2008-04-30 Thread Zhandong Liu
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. Please help me out on this. Here is the function: ## make the full pair-wise permutation of a vector ## input_fc=c(1,2,3); ## output_fc=