[R] run-time of an R function
Rossi, Peter E.
Peter.Rossi at chicagogsb.edu
Mon Jan 16 19:02:50 CET 2006
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
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
More information about the R-help
mailing list