I have a set of functions that run within a wrapper:
wrapper_func <- function(x,y,z,.....) {
t <- foo1(x,y)
kuku <- foo2(t,z)
....
final_res <- foo20(t, kuku, ...)
return(final_res)
}
It runs slowly and I want to understand who is the bottleneck/troublemaker. Please advise which function can perform deeper analysis (benchmark?microbenchmark?...) that will show the drilldown - which row/function takes the most time/resources?
I have found out another option
and go to the Memory profiling with lineprof chapter.
What do you think?
You can use Rprof
to profile your R code and find the performance bottlenecks; here's a short example
tmp <- tempfile()
Rprof(tmp)
example(glm)
Rprof()
summaryRprof(tmp)
A more extensive description can be found at this R-bloggers article.