Chapter 23 Performance

Transform your poor-performing prototype app into a fast one capable of handling thousands to tens of thousands of users simultaneously.

Learning Objectives

  • Benchmark your app using the shinyloadtest package to simulate multiple users.
  • Audit your app with the Google Lighthouse node.js package to evaluate front-end performance.
  • Profile your app to identify performance bottlenecks:
    • Use the profvis package to pinpoint slow R code.
    • Use shiny.tictoc JavaScript to measure:
      • Time spent on server-side calculations
      • Time needed to recalculate outputs
  • Optimize your code by:
    • Moving data preparation code outside the app
    • Making the code faster
    • Caching reactives and outputs
    • Applying psychological principles to make your app feel faster