We’re building a R Shiny dashboard to display big datasets. In our production environment we sometimes experience slow performance. Profiling with the profvis package is our plan to fix this.
The profvis package needs to be installed. Then it can be used by encapsulating the startcode in a profvis call.
# only once
install.packages("profvis")
# in your startcode
library(profvis)
profvis({
shiny::runApp(app)
})
After the R Shiny dashboard starts we followed a test scenario and stopped the app. Then R Studio showed us the profile data in two tabs (images below). One tab with a flame graph so you can see the spikes in (wait) time / memory during the test scenario. The other tab shows the same data in a table per file / function.


We now have a better understanding where our dashboard is performing less optimal. After changing the code we can start another profvis session to see if the changes fix or add to the problem.