Profiling code in Rstudio




I've been asked about profiling R code. I've never done that (unless you consider using microbenchmark on different versions of a function as poor man's profiling :stuck_out_tongue_winking_eye:). Hadley suggests to use lineprof in Advanced R I know that RStudio supports profvis integration.

  1. Which solution or package do you suggest me to use?
  2. I need to train people on this stuff, so I need to study and learn this well, and I need references. I don't think a simple blog post will give me enough expertise to train others, unless it's a fairly comprehensive tutorial. Can you refer me to books or papers on this?

PS MOOCs recommendations would be fine.


I would say that "Advanced R" is as close to a book as you can get about this topic.
Personally, I use profvis and it is quite OK to understand the problems. I didn't use lineprof yet, so nothing to say about it.