[R] run-time of an R function

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jan 16 20:35:35 CET 2006


On Mon, 16 Jan 2006, Alexandre Santos Aguiar wrote:

> Em Seg 16 Jan 2006 16:02, Rossi, Peter E. escreveu:
>> 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).
>
> Hi,
>
> I am currently using extensively a script with +250 lines that performed the
> opposite:
>
> 3min 26s as first run
> 2min 57s in the second run and with several objects in memory

This sounds like of those cases where automatic tuning of the garbage 
collector is helping.  Setting the startup parameters (see ?Memory) to 
similar values to gc() reports at the end of the run will probably help.
You can get further information from gc.time().

Most often performance deteriorates during a session as Uwe Ligges points 
out (at least on a 32-bit system as he uses).

> My script performs calculations of bayesian probabilities over 11 variables of
> 1033 observations, uses no special library, performs several disk writes to a
> networked nfs exported directory and does the clean up of all explicitly
> created objects.
>
> BTW, I currently use R 2.2.1 and it seems much faster than version 1.9 that I
> used before.

Not surprising as we continually do performance tuning.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list