How to profile functions of class R6?

Class R6 functions are anonymous, so profiling information is lost. For instance:

library(R6) library(proftools) Test <- R6Class("Test", public = list( fn = function() pause(0.3) ) ) obj <- Test$new() # # Profile Rprof(line.profiling=TRUE) replicate(10, obj$fn()) Rprof(NULL) png('profile-self.png') plotProfileCallGraph(readProfileData(), score='self') dev.off() 

contains the following profile information:

graph graph

How can I effectively profile these features?

+4
source share
1 answer

If you use the latest version of R-devel (since this commit ), it will output obj$fn instead of <Anonymous> in the profiling data. This should be in the next version of R (3.3.0?).

+1
source

All Articles