In this chapter, we learned how to measure the execution time of R expressions using system.time()
, benchmark()
(from the rbenchmark
package) and microbenchmark()
(from the microbenchmark
package). We examined how to profile the execution time and memory usage of different parts of an R program using Rprof()
and summaryRprof()
and to display the results in an intuitive visual form using the proftools
package.
We also saw the role of OS-provided monitoring tools to understand the overall performance of R programs and how these system measures can provide clues about the performance bottlenecks that our R programs might be facing.
Finally, we learned how to apply the profiling techniques in a practical, iterative workflow to identify, prioritize and resolve performance related problems in an R code.
In the next chapter, we will learn some simple tweaks to improve R code so that it runs faster.