timed {spatstat.geom}R Documentation

Record the Computation Time

Description

Saves the result of a calculation as an object of class "timed" which includes information about the time taken to compute the result. The computation time is printed when the object is printed.

Usage

timed(x, ..., starttime = NULL, timetaken = NULL)

Arguments

x

An expression to be evaluated, or an object that has already been evaluated.

starttime

The time at which the computation is defined to have started. The default is the current time. Ignored if timetaken is given.

timetaken

The length of time taken to perform the computation. The default is the time taken to evaluate x.

...

Ignored.

Details

This is a simple mechanism for recording how long it takes to perform complicated calculations (usually for the purposes of reporting in a publication).

If x is an expression to be evaluated, timed(x) evaluates the expression and measures the time taken to evaluate it. The result is saved as an object of the class "timed". Printing this object displays the computation time.

If x is an object which has already been computed, then the time taken to compute the object can be specified either directly by the argument timetaken, or indirectly by the argument starttime.

If the result of evaluating x belongs to other S3 classes, then the result of timed(x, ...) also inherits these classes, and printing the object will display the appropriate information for these classes as well.

Value

An object inheriting the class "timed".

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.

See Also

timeTaken to extract the time taken.

Examples

  timed(minnndist(cells))

  answer <- timed(42, timetaken=4.1e17)
  answer

[Package spatstat.geom version 3.3-2 Index]