Re: [R] run-time of an R function

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Tue 17 Jan 2006 - 05:29:04 EST

Rossi, Peter E. wrote:

> I have noticed dramatic differences in the run-time for the execution of
> one of my functions depending on whether or not R was restarted.
> Immediately
> after restart of R GUI, exec time = 2.8 min. If I then repeat the
> execution
> of the function in the same R session, exec time = 7.1 min. Removing all
> objects via rm(list=(all=TRUE)) and initiating gc (gc(reset=TRUE))
> helps, but
> only slightly (exec time = 5.0 min).
>
> any thoughts on why this happens?

Quite probably due to memory fragmentation. Smaller objects and more RAM might help a little bit.

Uwe Ligges

> I realize that this is somewhat of a generic question given that I
> haven't
> provided the source code for the function. However, the function
> is very involved so that I think presenting it might violate the posting
> guidelines. The function creates and recreates large list structures
> and calls numerical functions on elements of these lists. The list
> structures
> can be nested several levels deep, e.g. a list of lists.
>
> Are there particular aspects of R function programming to watch out for
> that can create this sort of problem?
>
> I'm running windows R v 2.2.1
>
> thanks!
>
> peter r
>
>
> ................................
> Peter E. Rossi
> Joseph T. and Bernice S. Lewis Professor of Marketing and Statistics
> Editor, Quantitative Marketing and Economics
> Rm 353, Graduate School of Business, U of Chicago
> 5807 S. Woodlawn Ave, Chicago IL 60637, USA
> Tel: (773) 702-7513 | Fax: (773) 834-2081
>
> ______________________________________________
> R-help@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



R-help@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 Received on Tue Jan 17 05:43:22 2006

This archive was generated by hypermail 2.1.8 : Tue 17 Jan 2006 - 14:04:02 EST