[R] run-time of an R function

From: Rossi, Peter E. <Peter.Rossi_at_chicagogsb.edu>
Date: Tue 17 Jan 2006 - 05:02:50 EST

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?

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


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 Received on Tue Jan 17 05:07:06 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:04 EST