Package microbenchmark

Similar documents
Package datasets.load

Package wethepeople. March 3, 2013

Package logspline. February 3, 2016

Package tspmeta. July 8, 2015

Package fso. February 19, 2015

Package autocogs. September 22, Title Automatic Cognostic Summaries Version 0.1.1

Package spark. July 21, 2017

Package cgh. R topics documented: February 19, 2015

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package condir. R topics documented: February 15, 2017

Package sspline. R topics documented: February 20, 2015

2.2 Scientific Notation & Dimensional Analysis. Monday, September 23, 13

Package crossword.r. January 19, 2018

Package esabcv. May 29, 2015

Package pso. R topics documented: February 20, Version Date Title Particle Swarm Optimization

Package bootlr. July 13, 2015

Package queuecomputer

Package JOP. February 19, 2015

Package desire. R topics documented: February 19, Version Title Desirability functions in R

Package CINID. February 19, 2015

Package lvplot. August 29, 2016

Package cosinor. February 19, 2015

Arachne. Core Aware Thread Management Henry Qin Jacqueline Speiser John Ousterhout

Package gsalib. R topics documented: February 20, Type Package. Title Utility Functions For GATK. Version 2.1.

Package superheat. February 4, 2017

Package benchmarkme. R topics documented: February 26, Type Package Title Crowd Sourced System Benchmarks Version 0.2.

Package sure. September 19, 2017

Package QCAtools. January 3, 2017

Package dgo. July 17, 2018

Package HMMCont. February 19, 2015

Package MTLR. March 9, 2019

Package areaplot. October 18, 2017

Package bigreg. July 25, 2016

Package RYoudaoTranslate

Package svalues. July 15, 2018

Package abf2. March 4, 2015

Package panelview. April 24, 2018

Package kdetrees. February 20, 2015

Package Mondrian. R topics documented: March 4, Type Package

Package qicharts2. March 3, 2018

Package catchr. R topics documented: December 30, Type Package. Title Catch, Collect, and Raise Conditions. Version 0.1.0

Package catenary. May 4, 2018

Package qicharts. October 7, 2014

$t = timeit($count, '...other code...') print "$count loops of other code took:",timestr($t),"\n";

Package d3heatmap. February 1, 2018

Package assertr. R topics documented: February 23, Type Package

Package corclass. R topics documented: January 20, 2016

Package CatEncoders. March 8, 2017

Package mixphm. July 23, 2015

Separating Access Control Policy, Enforcement, and Functionality in Extensible Systems. Robert Grimm University of Washington

Package CausalImpact

Package texteffect. November 27, 2017

Package docxtools. July 6, 2018

Package ggsubplot. February 15, 2013

Package robets. March 6, Type Package

Package pcapa. September 16, 2016

Package SPIn. R topics documented: February 19, Type Package

Package kdtools. April 26, 2018

Package aop. December 5, 2016

Package marketsim. February 15, Type Package. Title Market simulator for R. Version 0.9. Date Author Ari Friedman

Package r2d2. February 20, 2015

Package beast. March 16, 2018

Package tidyimpute. March 5, 2018

Package Daim. February 15, 2013

Package OLScurve. August 29, 2016

Package RCA. R topics documented: February 29, 2016

Package rferns. November 15, 2017

Package snow. R topics documented: February 20, 2015

Package rollply. R topics documented: August 29, Title Moving-Window Add-on for 'plyr' Version 0.5.0

Package pmg. R topics documented: March 9, Version Title Poor Man s GUI. Author John Verzani with contributions by Yvonnick Noel

Package rpst. June 6, 2017

Package maboost. R topics documented: February 20, 2015

Package sparsereg. R topics documented: March 10, Type Package

Package hypercube. December 15, 2017

Package ClusterBootstrap

Package fastdummies. January 8, 2018

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package fastqcr. April 11, 2017

Package svmpath. R topics documented: August 30, Title The SVM Path Algorithm Date Version Author Trevor Hastie

Package PSTR. September 25, 2017

Package beanplot. R topics documented: February 19, Type Package

Package ssd. February 20, Index 5

Package bisect. April 16, 2018

Package Rdrools. July 22, 2017

Package sessioninfo. June 21, 2017

Package Rramas. November 25, 2017

Package fractalrock. February 19, 2015

Package PIPS. February 19, 2015

Package HiResTEC. August 7, 2018

Package coefplot. R topics documented: February 15, Type Package. Title Plots Coefficients from Fitted Models. Version

Package binomlogit. February 19, 2015

Package io. January 15, 2018

Package dalmatian. January 29, 2018

Package mds. April 27, 2018

Package quadprogxt. February 4, 2018

Package nonmem2r. April 5, 2018

Package edear. March 22, 2018

Package ezsim. R topics documented: February 19, Type Package

Package manet. September 19, 2017

Package filelock. R topics documented: February 7, 2018

Transcription:

Package microbenchmark Title Sub microsecond accurate timing functions. February 20, 2013 Provides infrastructure to accurately measure and compare the execution time of R expressions. Author Olaf Mersmann <olafm@p-value.net> Maintainer Olaf Mersmann <olafm@p-value.net> License BSD Suggests ggplot2 Imports graphics LazyData yes Version 1.3-0 Collate autoplot.r boxplot.r internal.r microbenchmark.r microtiming_precision.r print.r summary.r Date NeedsCompilation yes Repository CRAN Date/Publication 2013-02-20 15:05:50 R topics documented: autoplot.microbenchmark.................................. 2 boxplot.microbenchmark.................................. 3 coalesce........................................... 3 convert_to_unit....................................... 4 find_prefix.......................................... 5 microbenchmark...................................... 5 microtiming_precision................................... 7 print.microbenchmark.................................... 8 summary.microbenchmark................................. 8 1

2 autoplot.microbenchmark Index 10 autoplot.microbenchmark Autoplot method for microbenchmark objects: Prettier graphs for microbenchmark using ggplot2 Uses ggplot2 to produce a more legible graph of microbenchmark timings ## S3 method for class microbenchmark autoplot(object,..., log = TRUE, y_max = 1.05 * max(object$time)) object... Ignored log y_max A microbenchmark object If TRUE the time axis will be on log scale. The upper limit of the y axis (defaults to 5 percent more than the maximum value) A ggplot2 plot Ari Friedman, Olaf Mersmann Examples library("ggplot2") tm <- microbenchmark(rchisq(100, 0), rchisq(100, 1), rchisq(100, 2), rchisq(100, 3), rchisq(100, 5), times=1000l) autoplot(tm)

boxplot.microbenchmark 3 boxplot.microbenchmark Boxplot of microbenchmark timings. Boxplot of microbenchmark timings. ## S3 method for class microbenchmark boxplot(x, unit = "t", log = TRUE, xlab, ylab,...) x A microbenchmark object. unit Unit in which the results be plotted. log Should times be plotted on log scale? xlab X axes label. ylab Y axes label.... Passed on to boxplot.formula. Olaf Mersmann <olafm@p-value.net> coalesce Return first non null argument. This function is useful when processing complex arguments with multiple possible defaults based on other arguments that may or may not have been provided. coalesce(...)... List of values.

4 convert_to_unit First non null element in... Olaf Mersmann <olafm@statistik.tu-dortmund.de> convert_to_unit Convert timings to different units. The following units of time are supported ns Nanoseconds. us Microseconds. ms Milliseconds. s Seconds. t Appropriately prefixed time unit. hz Hertz / evaluations per second. eps Evaluations per second / Hertz. khz Kilohertz / 1000s of evaluations per second. mhz Megahertz / 1000000s of evaluations per second. f Appropriately prefixed frequency unit. convert_to_unit(x, unit = c("ns", "us", "ms", "s", "t", "hz", "khz", "mhz", "eps", "f")) x unit An microbenchmark object. A unit of time. See details. A matrix containing the converted time values with an attribute unit which is a printable name of the unit of time. Olaf Mersmann <olafm@p-value.net>

find_prefix 5 find_prefix Find SI prefix for unit Find SI prefix for unit find_prefix(x, f = min, minexp = -Inf, maxexp = Inf, mu = TRUE) x f minexp maxexp mu a numeric function that produces the number from x that is used to determine the prefix, e.g. min or median. minimum (decimal) exponent to consider, e.g. -3 to suppress prefixes smaller than milli (m). maximum (decimal) exponent to consider, e.g. 3 to suppress prefixes larger than kilo (k). if TRUE, should a proper mu is used for micro, otherwise use u as ASCIIcompatible replacement character with the SI prefix Claudia Beleites microbenchmark Sub-millisecond accurate timing of expression evaluation. microbenchmark serves as a more accurate replacement of the often seen system.time(replicate(1000, expr)) expression. It tries hard to accurately measure only the time it takes to evaluate expr. To achieved this, the sub-millisecond (supposedly nanosecond) accurate timing functions most modern operating systems provide are used. Additionally all evaluations of the expressions are done in C code to minimze any overhead.

6 microbenchmark microbenchmark(..., list = NULL, times = 100L, unit, control = list())... Expressions to benchmark. list times control unit Details Note List of unevaluated expression to benchmark. Number of times to evaluate the expression. List of control arguments. See Details. Default unit used in summary and print. This function is only meant for micro-benchmarking small pieces of source code and to compare their relative performance characteristics. You should generally avoid benchmarking larger chunks of your code using this function. Instead, try using the R profiler to detect hot spots and consider rewriting them in C/C++ or FORTRAN. The control list can contain the following entries: order the order in which the expressions are evaluated. random (the default) randomizes the execution order, inorder executes each expression in order and block executes all repetitions of each expression as one block. warmup the number of warm-up iterations performed before the actual benchmark. These are used to estimate the timing overhead as well as spinning up the processor from any sleep or idle states it might be in. The default value is 2. Object of class microbenchmark, a matrix with one column per expression. Each row contains the time it took to evaluate the respective expression one time in nanoseconds. Depending on the underlying operating system, different methods are used for timing. On Windows the QueryPerformanceCounter interface is used to measure the time passed. For Linux the clock_gettime API is used and on Solaris the gethrtime function. Finally on MacOS X the, undocumented, mach_absolute_time function is used to avoid a dependency on the CoreServices Framework. Before evaluating each expression times times, the overhead of calling the timing functions and the C function call overhead are estimated. This estimated overhead is subtracted from each measured evaluation time. Should the resulting timing be negative, a warning is thrown and the respective value is replaced by NA. Olaf Mersmann <olafm@p-value.ner>

microtiming_precision 7 See Also print.microbenchmark to display and boxplot.microbenchmark to plot the results. Examples ## Measure the time it takes to dispatch a simple function call ## compared to simply evaluating the constant \code{null} f <- function() NULL res <- microbenchmark(null, f(), times=1000l) ## Print results: print(res) ## Plot results: boxplot(res) ## Pretty plot: if (require("ggplot2")) { plt <- ggplot2::qplot(y=time, data=res, colour=expr) plt <- plt + ggplot2::scale_y_log10() print(plt) } microtiming_precision Estimate precision of timing routines. This function is currently experimental. Its main use is to judge the quality of the underlying timer implementation of the operating system. The function measures the overhead of timing a C function call rounds times and returns all non-zero timings observed. This can be used to judge the granularity and resolution of the timing subsystem. microtiming_precision(rounds = 100L, warmup = 2^18) rounds warmup Number of measurements used to estimate the precision. Number of iterations used to warmup the CPU. A vector of observed non-zero timings. Olaf Mersmann <olafm@statistik.tu-dortmund.de>

8 summary.microbenchmark print.microbenchmark Print microbenchmark timings. The available units are nanoseconds ("ns"), microseconds ("us"), milliseconds ("ms"), seconds ("s") and evaluations per seconds ("eps") and relative runtime compared to the best median time ("relative"). ## S3 method for class microbenchmark print(x, unit, order = NULL,...) x unit order An object of class microbenchmark. What unit to print the timings in. If present, order results according to this column of the output.... Passed to print.data.frame See Also Olaf Mersmann <olafm@p-value.net> boxplot.microbenchmark for a plot method. summary.microbenchmark Summarize microbenchmark timings. The available units are nanoseconds ("ns"), microseconds ("us"), milliseconds ("ms"), seconds ("s") and evaluations per seconds ("eps") and relative runtime compared to the best median time ("relative"). ## S3 method for class microbenchmark summary(object, unit,...)

summary.microbenchmark 9 object unit See Also An object of class microbenchmark. What unit to print the timings in. If none is given, either the unit attribute of object or the option microbenchmark.unit is used and if neither is set t is used.... Passed to print.data.frame A data.frame containing the aggregated results. print.microbenchmark

Index autoplot.microbenchmark, 2 boxplot.microbenchmark, 3, 7, 8 coalesce, 3 convert_to_unit, 4 find_prefix, 5 median, 5 microbenchmark, 5 microtiming_precision, 7 min, 5 print.microbenchmark, 7, 8, 9 summary.microbenchmark, 8 10