Basic usage
library(chunkhooks)
hook_benchmark()
# benchmark=TRUE is specified as a chunk option
sum(seq(100))
#> [1] 5050
bench1: 5ms
As the above result shows, output format contains chunk label. I recommend specifying chunk options explicitly. Note that this function is experimental, and format may change in the future.
Insert results in body text
If you need to insert the result with the text, use chunkhooks::benchmarks
environment. This environment records all the benchmark results in seconds. You can extract a result by specifying a chunk label.
For example, r benchmarks$bench1
gives 0.004.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.