microbenchmark is provided as part of an R library. Once included in your script you then surround the code in question with a microbenchmark tag and once executed the tool will output profiling information for the script in question.
For example, we could have this use:
library(microbenchmark) x <- runif(125) microbenchmark( mean(x) )
Which would exercise the surrounded code 125 times (100 by default) and output profiling information such as:
Unit: nanoseconds expr min lq mean median uq max neval sqrt(x) 825 860.5 1212.79 892.5 938.5 12905 100 x^0.5 3015 3059.5 3776.81 3101.5 3208.0 15215 100
Where we are concerned with the mean as a good indication of how long each iteration is taking. We should also notice where there is a large divergence from the mean with very distant min and max values—which is what we have here.