benchmark               package:butler               R Documentation

_B_e_n_c_h_m_a_r_k

_D_e_s_c_r_i_p_t_i_o_n:

     Compare the performance of different functions

_U_s_a_g_e:

     benchmark(..., reps = 10)

_A_r_g_u_m_e_n_t_s:

     ...: functions to compare, make sure to name them (see example)

    reps: number of reps of each function to run

_D_e_t_a_i_l_s:

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

_A_u_t_h_o_r(_s):

     Hadley Wickham <h.wickham@gmail.com>

_E_x_a_m_p_l_e_s:

     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)

