I've been trying to dig into what the time-hogs are in some R code I've written, so I'm using Rprof
. The output isn't yet very helpful though:
> summaryRprof()
$by.self
self.time self.pct total.time total.pct
"$<-.data.frame" 2.38 23.2 2.38 23.2
"FUN" 2.04 19.9 10.20 99.6
"[.data.frame" 1.74 17.0 5.54 54.1
"[.factor" 1.42 13.9 2.90 28.3
...
Is there some way to dig deeper and find out which specific invocations of $<-.data.frame
, and FUN
(which is probably from by()
), etc. are actually the culprits? Or will I need to refactor the code and make smaller functional chunks in order to get more fine-grained results?
The only reason I'm resisting refactoring is that I'd have to pass data structures into the functions, and all the passing is by value, so that seems like a step in the wrong direction.
Thanks.