benchmark {butler}R Documentation

Benchmark

Description

Compare the performance of different functions

Usage

benchmark(..., reps = 10)

Arguments

... functions to compare, make sure to name them (see example)
reps number of reps of each function to run

Details

@arguments functions to compare, make sure to name them (see example) @arguments number of reps of each function to run @keyword debugging

Author(s)

Hadley Wickham <h.wickham@gmail.com>

Examples

mean1 = function() {x <- rnorm(1000); mean(x);}
mean2 = function() {x <- rnorm(1000); sum(x) / length(x);}
mean3 = function() {x <- rnorm(1000); total=0;for(i in 1:length(x)) {total <- total + x[i]}; total/length(x);}
mt = benchmark(mean=mean1,sum=mean2,loop=mean3, reps=1000)
print(mt)

[Package butler version 0.3 Index]