I want to use profr to profile my R code. I am confused on how to use this function because I cannot find any examples of its use. Is there a way I can call it from CMD as a argument while running my R program? This program consists of many scripts which adds to the confusion.
Share
It doesn’t run from the command line. It runs from within R. Here’s what I do.
Then I just examine the samples in the
Rprof.outfile.The way I do profiling is to take a small number of stack samples and then examine them directly, rather than putting them through some kind of statistical summarization.
The reason is, if there’s something taking enough time to be worth fixing, like, say, 40% of the time, then if I look at 10 random samples, on average it will be evident on 4 of them. I only have to see a problem on 2 samples to know it’s worth fixing, and I can see problems this way that will be missed by statistical summaries. That’s crucial.
The stack samples from
Rprofonly list functions. They don’t list the line numbers at which calls take place. Nevertheless, it’s a heck of a lot better than nothing.