speedcomp: Comparing CPU times of several R expressions

View source: R/speedcomp.R

speedcompR Documentation

Comparing CPU times of several R expressions

Description

This function enables comparing CPU times of several expressions. The times are calculated via system.time, additionally time ratios are calculated.

Usage

speedcomp(...)

Arguments

...

a collection of expressions in the form of tag=value

Details

The function uses system.time to estimate CPU times needed to evaluate each of the expressions. The output provides raw timings as well as ratios of time elapsed.

The included show method prints the results nicely and additionally calculates the ratios of times elapsed.

Value

An object of S4 class speedcomp with two slots

e

list of expressions processed

timings

matrix containing the CPU times of the expressions in e estimated with system.time. Rows correspond to expressions and columns to the fields returned by system.time, i.e. "user cpu", "system cpu", "elapsed", "subproc1" and "subproc2"

See Also

system.time

Examples


# some testing of 'lm' fitting with different data sizes
e1 <- expression( lm( I(rnorm(10000)) ~ I(runif(10000)) ) )
e2 <- expression( lm( I(runif(20000)) ~ I(rnorm(20000)) ) )

# compare
speedcomp(e1, e2)



mbojan/mbtools documentation built on Oct. 16, 2023, 8:18 p.m.