microbenchmark
is a lightweight (~50kB) package and more-or-less a standard way in R for benchmarking multiple expressions and functions:
microbenchmark(myfunction(with,arguments))
For example:
> microbenchmark::microbenchmark(log10(5), log(5)/log(10), times = 10000)
Unit: nanoseconds
expr min lq mean median uq max neval cld
log10(5) 0 0 25.5738 0 1 10265 10000 a
log(5)/log(10) 0 0 28.1838 0 1 10265 10000
Here both the expressions were evaluated 10000 times, with mean execution time being around 25-30 ns.