Learn R Programming

benchr (version 0.2.5)

print.benchmark: Print method for the benchmark timings.

Description

This is universal method of measurement results representation, which can be called either implicitly or explicitly. The method uses summary method to compute aggregated statistics for benchmarking results. print also provides additional information about the timer precision and overhead, the execution regime and the number of repeats.

Usage

# S3 method for benchmark
print(
  x,
  units = "auto",
  order = "none",
  relative = "median",
  details = FALSE,
  ...
)

# S3 method for summaryBenchmark print(x, units = "auto", order = "none", ...)

Arguments

x

An object of class benchmark, summaryBenchmark or meanBenchmark.

units

Character. The units to be used in printing the timings. The available units are nanoseconds ("ns"), microseconds ("us"), milliseconds ("ms"), seconds ("s").

order

Character. Order results according to this column of the output.

relative

Character. The name or index of the column whose values will be used to compute relative timings.

details

Logical. Show additional detauls about measurement process.

...

Arguments passed on to print.data.frame().

Value

Apart from the table output produced by summary, the method also prints additional information about the benchmarking process (with details = TRUE):

Timer precision

Timer precision in seconds.

Timer error

Timer error (overhead) in seconds.

Replications

Number of repeats for each expression.

Expressions order

Execution regime.

Garbage collection

Whether garbage collection took place before each execution.

See Also

summary.benchmark(), mean.benchmark()

Examples

Run this code
# NOT RUN {
a1 <- a2 <- a3 <- a4 <- numeric(0)
res <- benchmark(
  a1 <- c(a1, 1),
  a2 <- append(a2, 1),
  a3[length(a3) + 1] <- 1,
  a4[[length(a4) + 1]] <- 1
)
print(res)
# }

Run the code above in your browser using DataLab