Using profvis on my app shows that the bottleneck is the code below, which is the entirety of my server file. My app is extremely large and so I have my server code broken up into a collection of individual files (all labeled as "xx.R"). The code below I thought was clever, but perhaps not. My app finds any file with the .R extensions in my server folder and loads it here. This was a nice way to manage code and "works" in the sense that all code is read in properly.
shinyServer(function(input, output, session) {
allServerFiles <- list.files(file.path("Rcode/serverFiles"), pattern = '.R')
sapply(allServerFiles, function(x) source(file.path("Rcode/serverFiles", x), local = TRUE)$value)
})
Is there any obvious reason why this would be such a big bottleneck? Is there a canonical way to approach this better?
Thanks.