R6 class functions are anonymous so profiling information is lost. For example:
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()
gives the following profile information:
How can I profile these functions effectively?