Code Profiling in R: A Review of Existing Methods and an Introduction to Package GUIProfiler

Code analysis tools are crucial to understand program behavior. Profile tools use the results of time measurements in the execution of a program to gain this understanding and thus help in the optimization of the code. In this paper, we review the different available packages to profile R code and show the advantages and disadvantages of each of them. In additon, we present GUIProfiler, a package that fulfills some unmet needs. Package GUIProfiler generates an HTML report with the timing for each code line and the relationships between different functions. This package mimics the behavior of the MATLAB profiler. The HTML report includes information on the time spent on each of the lines of the profiled code (the slowest code is highlighted). If the package is used within the RStudio environment, the user can navigate across the bottlenecks in the code and open the editor to modify the lines of code where more time is spent. It is also possible to edit the code using Notepad++ (a free editor for Windows) by simply clicking on the corresponding line. The graphical user interface makes it easy to identify the specific lines which slow down the code. The integration in RStudio and the generation of an HTML report makes GUIProfiler a very convenient tool to perform code optimization.

Angel Rubio , Fernando de Villar
2015-11-18

CRAN packages used

aprof, proftools, profr, microbenchmark, Nozzle.R1, knitr, GUIProfiler, stringr, plyr, devtools, shiny

CRAN Task Views implied by cited packages

HighPerformanceComputing, ReproducibleResearch, WebTechnologies

Bioconductor packages used

Rgraphviz, graph

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

Rubio & Villar, "Code Profiling in R: A Review of Existing Methods and an Introduction to Package GUIProfiler", The R Journal, 2015

BibTeX citation

@article{RJ-2015-036,
  author = {Rubio, Angel and Villar, Fernando de},
  title = {Code Profiling in R: A Review of Existing Methods and an Introduction to Package GUIProfiler},
  journal = {The R Journal},
  year = {2015},
  note = {https://doi.org/10.32614/RJ-2015-036},
  doi = {10.32614/RJ-2015-036},
  volume = {7},
  issue = {2},
  issn = {2073-4859},
  pages = {275-287}
}