Skip to content

Instantly share code, notes, and snippets.

View merolagio's full-sized avatar

Giovanni Merola merolagio

  • Xi'an Jiaotong-Liverpool University
  • People's Republic of China
View GitHub Profile
@merolagio
merolagio / mbm_rel.R
Last active July 16, 2019 06:09
[R] microbenchmark relative summary
mbm_rel <- function(x, d, relname = NULL, relpos = 1, inverse = FALSE, reltime = TRUE, unit){
## produces relative summaries from microbenchmark output ================
## ---- arguments ----------------------------------------------------------
## x a microbenchmark output object with two or more methods
## d number of rows to consider (in the order of rows of x)
## relname is name of metod for relative results
## relpos is the position of target metod for relative results relmethod/othermethod
## inverse = TRUE compute othermethods/relmethod or viceversa
## reltime, if true prints the time taken by the method, otherwise sets its values to 1
## unit can be “ns”, “us”, “ms”, “s”, “t”, “hz”, “khz”, “mhz”, “eps”, “f”