Re: [R] Why R is 200 times slower than Matlab ?
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 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 package on CRAN, jit, that aims to provide similar speedups. http://www.milbo.users.sonic.net/ra/index.html Great! I just found out about ra. In Python I love psyco and I guess I will test ra soon. Thanks, N.- -- http://arhuaco.org __ R-help@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. [[alternative HTML version deleted]] __ R-help@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.
Re: [R] Why R is 200 times slower than Matlab ?
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 was introduced in Matlab huge speedups of Matlab programs were noticeable. For R, there is a new package on CRAN, jit, that aims to provide similar speedups. http://www.milbo.users.sonic.net/ra/index.html Great! I just found out about ra. In Python I love psyco and I guess I will test ra soon. Does somebody know where one could find a rpm of Ra for Fedora 8? Paul __ R-help@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.
Re: [R] Why R is 200 times slower than Matlab ?
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 compiled code. My intent is that the compute-intensive parts of the functions in the lme4 package are performed in compiled code. You could profile the execution of a call to lmer that is taking a long time and see where the time is being spent. See ?Rprof for details. An even simpler measure is to add the optional argument verbose = TRUE in a call to lmer and watch the output of the iterations. Everything from the appearance of the first iteration output to the appearance of the last iteration output takes place in a single .Call to a C function mer_optimize. Performance during that period will depend on the C compiler used, the level of optimization used, the use of an accelerated BLAS (which sometimes can be counter-intuitive, we have seen situations where use of an accelerated BLAS slowed down the execution) and, of course, your hardware. Also, during that call the memory profile should stay essentially constant. There is some allocation and freeing of memory taking place during that call but only a few, relatively small, chunks are involved. I just realized that I am speaking about the behavior of the development version of the lme4 package, available on R-forge. The release version is similar but not quite as tightly coded. As indicated above, the first step in optimizing any code should always be to profile the execution of the code and R does provide tools for that. 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 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 package on CRAN, jit, that aims to provide similar speedups. http://www.milbo.users.sonic.net/ra/index.html Great! I just found out about ra. In Python I love psyco and I guess I will test ra soon. Thanks, N.- -- http://arhuaco.org __ R-help@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. [[alternative HTML version deleted]] __ R-help@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. __ R-help@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.
Re: [R] Why R is 200 times slower than Matlab ?
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 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 package on CRAN, jit, that aims to provide similar speedups. http://www.milbo.users.sonic.net/ra/index.html Great! I just found out about ra. In Python I love psyco and I guess I will test ra soon. Thanks, N.- -- http://arhuaco.org -- Zhandong Liu Genomics and Computational Biology University of Pennsylvania 616 BRB II/III, 421 Curie Boulevard University of Pennsylvania School of Medicine Philadelphia, PA 19104-6160 [[alternative HTML version deleted]] __ R-help@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.
Re: [R] Why R is 200 times slower than Matlab ?
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 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=( 1 1 1 2 2 2 3 3 3 1 2 3 1 2 3 1 2 3 ); grw_permute = function(input_fc){ fc_vector = input_fc index = 1 k = length(fc_vector) fc_matrix = matrix(0,2,k^2) for(i in 1:k){ for(j in 1:k){ fc_matrix[index] = fc_vector[i] fc_matrix[index+1] = fc_vector[j] index = index+2 } } return(fc_matrix) } For an input vector of size 300. It took R 2.17 seconds to run. But the same code in matlab only needs 0.01 seconds to run. Am I missing sth in R.. Is there a away to optimize. ??? Thanks -- Zhandong Liu Genomics and Computational Biology University of Pennsylvania 616 BRB II/III, 421 Curie Boulevard University of Pennsylvania School of Medicine Philadelphia, PA 19104-6160 [[alternative HTML version deleted]] __ R-help@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. -- === WenSui Liu ChoicePoint Precision Marketing Phone: 678-893-9457 Email : [EMAIL PROTECTED] Blog : statcompute.spaces.live.com __ R-help@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.
Re: [R] Why R is 200 times slower than Matlab ?
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 [EMAIL PROTECTED]UNIL DGM __ R-help@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.
Re: [R] Why R is 200 times slower than Matlab ?
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 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=( 1 1 1 2 2 2 3 3 3 1 2 3 1 2 3 1 2 3 ); grw_permute = function(input_fc){ fc_vector = input_fc index = 1 k = length(fc_vector) fc_matrix = matrix(0,2,k^2) for(i in 1:k){ for(j in 1:k){ fc_matrix[index] = fc_vector[i] fc_matrix[index+1] = fc_vector[j] index = index+2 } } return(fc_matrix) } For an input vector of size 300. It took R 2.17 seconds to run. But the same code in matlab only needs 0.01 seconds to run. Am I missing sth in R.. Is there a away to optimize. ??? Thanks -- Zhandong Liu Genomics and Computational Biology University of Pennsylvania 616 BRB II/III, 421 Curie Boulevard University of Pennsylvania School of Medicine Philadelphia, PA 19104-6160 [[alternative HTML version deleted]] __ R-help@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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@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.
Re: [R] Why R is 200 times slower than Matlab ?
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 avoid messy indexing and 'for' loops. Look at the following 3 functions. Yours, Gabor's, and my own (which I was about to post when I saw Gabor's nice solution, and is basically the same). Also see the system timings after the definitions. grw_permute - function(input_fc){ fc_vector - input_fc index - 1 k - length(fc_vector) fc_matrix - matrix(0, 2, k^2) for(i in 1:k){ for(j in 1:k){ fc_matrix[index] - fc_vector[i] fc_matrix[index+1] - fc_vector[j] index - index + 2 } } return(fc_matrix) } grw.permute2 - function(v) { cbind( rep(v, each=length(v)), rep(v, length(v)) ) } grw_permute3 - function(input_fc) { matrix(c(rep(input_fc, each = length(input_fc)), rep.int(input_fc, times = length(input_fc))), nrow = 2, byrow = TRUE) } system.time(p1 - grw_permute(1:300)) user system elapsed 1.548 0.064 2.341 system.time(p2 - grw_permute2(1:300)) user system elapsed 0.009 0.001 0.010 system.time(p3 - grw_permute3(1:300)) user system elapsed 0.008 0.002 0.010 Erik Iverson __ R-help@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.
Re: [R] Why R is 200 times slower than Matlab ?
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 languages and HTH. http://www.sciviews.org/benchmark/index.html [...] -- Csardi Gabor [EMAIL PROTECTED]UNIL DGM __ R-help@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.
Re: [R] Why R is 200 times slower than Matlab ?
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(1,2,3); ## output_fc=( 1 1 1 2 2 2 3 3 3 1 2 3 1 2 3 1 2 3 ); grw_permute = function(input_fc){ fc_vector = input_fc index = 1 k = length(fc_vector) fc_matrix = matrix(0,2,k^2) for(i in 1:k){ for(j in 1:k){ fc_matrix[index] = fc_vector[i] fc_matrix[index+1] = fc_vector[j] index = index+2 } } return(fc_matrix) } For an input vector of size 300. It took R 2.17 seconds to run. But the same code in matlab only needs 0.01 seconds to run. Am I missing sth in R.. Is there a away to optimize. ??? Thanks This is pretty characteristic. With R, you really don't want nested loops doing single-element accessing (if you have better things to do with 2.16 seconds of our life). You will usually find that this sort of problem is handled either using vectorized operations at a higher level, or pushed into C code which is dynamically loaded. For the particular problem, notice that the same result is obtained with system.time(rbind(rep(1:300,300),rep(1:300,each=300))) user system elapsed 0.041 0.006 0.050 or even (OK, so it's transposed) system.time(expand.grid(1:300,1:300)) user system elapsed 0.027 0.011 0.040 -- O__ Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@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.
Re: [R] Why R is 200 times slower than Matlab ?
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 permutation of a vector ## input_fc=c(1,2,3); ## output_fc=( 1 1 1 2 2 2 3 3 3 1 2 3 1 2 3 1 2 3 ); grw_permute = function(input_fc){ fc_vector = input_fc index = 1 k = length(fc_vector) fc_matrix = matrix(0,2,k^2) for(i in 1:k){ for(j in 1:k){ fc_matrix[index] = fc_vector[i] fc_matrix[index+1] = fc_vector[j] index = index+2 } } return(fc_matrix) } For an input vector of size 300. It took R 2.17 seconds to run. But the same code in matlab only needs 0.01 seconds to run. I am not a MATLAB user, but I suspect it wasn't the same code that produced an answer in MATLAB, but you don't provide your MATLAB code, nor do you specify what version of R, of MATLAB, or what hardware and OS you are using. I get {NetBSD, R version 2.6.0 (2007-10-03), Core 2 Duo, 3.x GHz}: input_fc - sample(1:600) unix.time(a1 - grw_permute(input_fc)) user system elapsed 3.279 -0.001 3.280 unix.time({n - length(input_fc); a2 - matrix(c(rep(input_fc, each=n), rep(input_fc, n)), 2, n*n, byrow = T)}) user system elapsed 0.019 0.020 0.040 all.equal(a1, a2) [1] TRUE A sample of length 300 took less than 1 second using your grw_permute() (so your OS may be making a difference as well). Am I missing sth in R.. Is there a away to optimize. ??? Yes. Loops are not efficient in R. Thanks HTH, Ray Brownrigg __ R-help@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.
Re: [R] Why R is 200 times slower than Matlab ?
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, 2008 at 4:47 PM, Ray Brownrigg [EMAIL PROTECTED] wrote: 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 permutation of a vector ## input_fc=c(1,2,3); ## output_fc=( 1 1 1 2 2 2 3 3 3 1 2 3 1 2 3 1 2 3 ); grw_permute = function(input_fc){ fc_vector = input_fc index = 1 k = length(fc_vector) fc_matrix = matrix(0,2,k^2) for(i in 1:k){ for(j in 1:k){ fc_matrix[index] = fc_vector[i] fc_matrix[index+1] = fc_vector[j] index = index+2 } } return(fc_matrix) } For an input vector of size 300. It took R 2.17 seconds to run. But the same code in matlab only needs 0.01 seconds to run. I am not a MATLAB user, but I suspect it wasn't the same code that produced an answer in MATLAB, but you don't provide your MATLAB code, nor do you specify what version of R, of MATLAB, or what hardware and OS you are using. I get {NetBSD, R version 2.6.0 (2007-10-03), Core 2 Duo, 3.x GHz}: input_fc - sample(1:600) unix.time(a1 - grw_permute(input_fc)) user system elapsed 3.279 -0.001 3.280 unix.time({n - length(input_fc); a2 - matrix(c(rep(input_fc, each=n), rep(input_fc, n)), 2, n*n, byrow = T)}) user system elapsed 0.019 0.020 0.040 all.equal(a1, a2) [1] TRUE A sample of length 300 took less than 1 second using your grw_permute() (so your OS may be making a difference as well). Am I missing sth in R.. Is there a away to optimize. ??? Yes. Loops are not efficient in R. Thanks HTH, Ray Brownrigg -- Zhandong Liu Genomics and Computational Biology University of Pennsylvania 616 BRB II/III, 421 Curie Boulevard University of Pennsylvania School of Medicine Philadelphia, PA 19104-6160 [[alternative HTML version deleted]] __ R-help@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.
Re: [R] Why R is 200 times slower than Matlab ?
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 very much like translating poetry, where the result should really be a poem in the target language, not just an accurate word-for-word (or even sentence-for-sentence) translation. Ray On Thu, 01 May 2008, you wrote: 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, 2008 at 4:47 PM, Ray Brownrigg [EMAIL PROTECTED] wrote: 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 permutation of a vector ## input_fc=c(1,2,3); ## output_fc=( 1 1 1 2 2 2 3 3 3 1 2 3 1 2 3 1 2 3 ); grw_permute = function(input_fc){ fc_vector = input_fc index = 1 k = length(fc_vector) fc_matrix = matrix(0,2,k^2) for(i in 1:k){ for(j in 1:k){ fc_matrix[index] = fc_vector[i] fc_matrix[index+1] = fc_vector[j] index = index+2 } } return(fc_matrix) } For an input vector of size 300. It took R 2.17 seconds to run. But the same code in matlab only needs 0.01 seconds to run. I am not a MATLAB user, but I suspect it wasn't the same code that produced an answer in MATLAB, but you don't provide your MATLAB code, nor do you specify what version of R, of MATLAB, or what hardware and OS you are using. I get {NetBSD, R version 2.6.0 (2007-10-03), Core 2 Duo, 3.x GHz}: input_fc - sample(1:600) unix.time(a1 - grw_permute(input_fc)) user system elapsed 3.279 -0.001 3.280 unix.time({n - length(input_fc); a2 - matrix(c(rep(input_fc, each=n), rep(input_fc, n)), 2, n*n, byrow = T)}) user system elapsed 0.019 0.020 0.040 all.equal(a1, a2) [1] TRUE A sample of length 300 took less than 1 second using your grw_permute() (so your OS may be making a difference as well). Am I missing sth in R.. Is there a away to optimize. ??? Yes. Loops are not efficient in R. Thanks HTH, Ray Brownrigg __ R-help@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.
Re: [R] Why R is 200 times slower than Matlab ?
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 package on CRAN, jit, that aims to provide similar speedups. 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 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=( 1 1 1 2 2 2 3 3 3 1 2 3 1 2 3 1 2 3 ); grw_permute = function(input_fc){ fc_vector = input_fc index = 1 k = length(fc_vector) fc_matrix = matrix(0,2,k^2) for(i in 1:k){ for(j in 1:k){ fc_matrix[index] = fc_vector[i] fc_matrix[index+1] = fc_vector[j] index = index+2 } } return(fc_matrix) } For an input vector of size 300. It took R 2.17 seconds to run. But the same code in matlab only needs 0.01 seconds to run. Am I missing sth in R.. Is there a away to optimize. ??? Thanks -- Zhandong Liu Genomics and Computational Biology University of Pennsylvania 616 BRB II/III, 421 Curie Boulevard University of Pennsylvania School of Medicine Philadelphia, PA 19104-6160 [[alternative HTML version deleted]] __ R-help@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. __ R-help@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.
Re: [R] Why R is 200 times slower than Matlab ?
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 introduced in Matlab huge speedups of Matlab programs were noticeable. For R, there is a new package on CRAN, jit, that aims to provide similar speedups. http://www.milbo.users.sonic.net/ra/index.html Great! I just found out about ra. In Python I love psyco and I guess I will test ra soon. Thanks, N.- -- http://arhuaco.org __ R-help@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.