[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-help
Subject:    Re: [R] efficiency & profiling? (was: Why R is 200 times slower
From:       Gabor Csardi <csardi () rmki ! kfki ! hu>
Date:       2008-04-30 23:32:13
Message-ID: 20080430233213.GB14301 () localdomain
[Download RAW message or body]

On Wed, Apr 30, 2008 at 06:59:38PM -0400, esmail bonakdarian wrote:
> 
> This has been an interesting discussion, and brings up two questions
> for me:
> 
> Is there a good collection of hints/suggestions for R language idoms in terms
> of efficiency? For instance I read not to use for-loops, so I used apply only to
> later read that "apply" is internally implemented as a "for" so nothing gained
> here. Warnings about pitfalls (such as nested loops), hints, suggestions would
> be great.

Personally i like {l,t,}apply better, 1) it is more readable,
2) it takes two minutes to change it to par{L,S,}apply and then 
it runs in parallel.

> The second question - is there some sort of profiling tool available that would
> make it easy to recognize where the script is spending most of its time? Might
> be especially useful for newbies like me.

See ?Rprof

G.

[...]

-- 
Csardi Gabor <csardi@rmki.kfki.hu>    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.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic