[R] Compilation of R code
Liaw, Andy
andy_liaw at merck.com
Fri Jan 7 21:18:49 CET 2005
For figuring out where in the code the bottleneck is, a better tool is
probably the profiler. See:
http://cran.r-project.org/doc/manuals/R-exts.html#Profiling%20R%20code
HTH,
Andy
> From: Spencer Graves
>
> R is basically an interpreted language. To my knowledge, the
> standard approach to improving speed starts by finding which
> steps take
> the most time. This can be done using "proc.time" and / or
> "system.time" (preceded by "gc" to clean things up so the
> timing is more
> stable).
>
> Once you've determined which loop or function call consumes the
> most time, you then need to decide what to do about it. R is
> vectorized, so if you use loops like in Fortran or C, you
> might be able
> to replace complicated pieces of code with one or only a very few
> commands. This list has considered many questions about
> speed, so once
> you know which steps are taking the most time, you can search the
> archives as described in the posting guide,
> "http://www.R-project.org/posting-guide.html". If that does
> not solve
> the problem, you can translate a function into a compiled
> language like
> C. See help.start() -> "Writing R Extensions" -> "System and foreign
> language interfaces".
>
> hope this helps.
> spencer graves
>
> Depire Alexandre wrote:
>
> >Hello,
> >I'm a newbie on this list.
> >I have a R code but its execution take a very long time.
> >Is it possible to compile it (in C for example) to decrease
> the execution
> >time ?
> >
> >
> >
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
More information about the R-help
mailing list