On Sun, Jan 31, 2010 at 7:55 PM, Marc Jekel <feuerw...@gmx.de> wrote: > Dear R Fans, > > I was recently asking myself how quick R is in code execution.
R can be a million times quicker than C code. Badly written C code. Next question... > I have been > running simulations lately that need quite a time for execution and I was > wondering if it is reasonable at all to do more computational extensive > projects with R. Of course, it is possible to compare execution time for the > same code written in several languages but maybe someone has some experience > on the subject? The corollary to my first answer is that badly written R can be a million times slower than well written R. There are lots of techniques for writing faster (==better? discuss!) R code, including vectorizing loops, writing parts in C or Fortran and so on. The one thing you need to do first is... Profile Your Code! See help(Rprof). Also make sure you know how to tell what system resources your program is using in terms of real and swap memory (you didn't mention your platform - Unix or Windows?). Eventually you will hit speed limits and CPUs aren't getting much faster. But there are more of them, so you'll need to look into the various parallel processing magic things, eg in the HPC Task View on CRAN: http://ftp.heanet.ie/mirrors/cran.r-project.org/web/views/HighPerformanceComputing.html The future is very definitely multi-core. Barry ______________________________________________ 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.