When it comes to code optimization, what I've learned from Profs. Lumley &
Bates (and also V&R's S Programming) is:  Measure it.  

Write the code in several ways, and test and see how long each one takes.
Use Rprof() to see where the code is taking the most time and concentrate on
those.

This strategy works for time-efficiency, but not necessarily
memory-efficiency.  For that, I still do not know how to `measure', other
than monitoring memory used by the R process via `top' on Linux/Unix or the
task manager on Windoze.

HTH,
Andy

> From: [EMAIL PROTECTED]
> 
> I have been lurking in this list a while and searching in the 
> archives to
> find out how one learns to write fast R code. One solution 
> seems to be to
> write part of the code not in R but in C. However after 
> finding a benchmark
> article (http://www.sciviews.org/other/benchmark.htm) I have been more
> interested in making the R code itself more efficient. I 
> would like to find
> more info about this. I have tried to mail the contact person for the
> benchmark, but I have so recieved no reply.
> 
> I am not an R programmer (or statistican) so I do not know R 
> well. I am
> looking for some advice about writing fast R code. What about 
> the different
> data types for example? Is there some good place to start to 
> look for more
> info about this? 
> 
> 
> Thanks for any pointers
> Lennart
> 
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
> 


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments,...{{dropped}}

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to