Description Usage Arguments Details Value Note See Also Examples
This is a wrapper to Rprof
that cleans up
some of the profile hand-holding and provides easier
usage. This allows you to profile either a single
function call, or a whole block. Evaluation can be run
multiple times in order to assess variability in the
timings of each function call.
1 2 3 |
call |
a call; this can be a single function call or a whole block. |
replications |
integer; by default |
interval |
real. time interval between samples. |
memory.profiling |
logical. output memory usage statistics? |
times |
integer. how many times to call the function? |
show.warnings |
boolean. output a warning if any iteration of the run did not produce results? |
Function calls that get executed very quickly will be
missed by Rprof
, unless you set interval
very low. However, doing this will probably break things
(and isn't really important, since profiling is there to
help you catch the longest-running functions.) If you
really want to time quickly executed functions, you can
manually set the replications
argument: we
evaluate the call
replications
times, and
infer the (average) run-time of the function as
<time taken> / replications
.
An object of S3 classes timeit
and
data.frame
.
If you set the replications
argument high, you
will likely see some output from the do_timeout
call that is unrelated to your function call. This is due
to all the wrapping of a function call to be executed by
Rprof
introduces a minor overhead. For other
caveats, please see Rprof
.
Currently, timeit
does not support passing through
of arguments, so don't try to wrap timeit
in a
function call, whereby the call it attempts to evaluate
is passed from a parent function. For example,
f <- function(x) { timeit(x) }; f(rnorm(10))
won't work properly; a fix may come in the future.
mean.timeit
for mean running times over all
iterations processed, summary.timeit
for
summary statistics, plot.timeit
for
generating a boxplot of the returned times,
do_timeit
for the workhorse function, and
Rprof
for information on how R profiles
the execution of expressions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.