speedcomp | R Documentation |
This function enables comparing CPU times of several expressions. The times
are calculated via system.time
, additionally time ratios are
calculated.
speedcomp(...)
... |
a collection of expressions in the form of tag=value |
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.
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"
system.time
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.