From 30 to 3 Seconds: How We Made a Shiny App 10x Faster

Reading time:
time
min
By:
Guilherme Vituri
March 28, 2025

Shiny apps often slow down as they scale, especially when handling large datasets and multiple plots. If you've ever found yourself waiting too long for your dashboard to respond, you’re not alone.

In this quick post, we’ll walk you through a real-world case study where we improved a Shiny app’s performance, cutting its load time from 30 seconds to just 3 seconds with a few key optimizations.

The Problem: A Shiny App with Too Many Re-renders

Our app had:

  • A table with 5,000 rows and 15 columns
  • 15 charts generated from the table (bar, line, pie charts, etc.)
  • A sidebar with multiple sliders, each filtering different columns in the table

Every time a user moved a single slider, all 15 plots were re-rendered. This meant:

  • If each plot took 1 second to generate, the user had to wait 15 seconds every time they adjusted a filter.
  • The initial load time was even worse, 30 seconds before users could interact with the app.

Clearly, this wasn’t a great experience.

Your Shiny app deserves to run at its best. Learn how smart coding practices can make a big difference.

Step 1: Switching to a Faster Plotting Library

Our first optimization was simple but highly effective: we switched from Plotly to ECharts4r for plotting.

  • Plotly is powerful, but it can be slow for apps with many interactive charts.
  • ECharts4r is designed for high-performance visualization and renders charts much faster. 

According to this benchmark comparison, libraries like ECharts (built on the same foundation as uPlot) outperform Plotly in speed and rendering efficiency, especially when handling large datasets.

This reduced our initial load time from 30 seconds to 6 seconds.

Step 2: Preventing Unnecessary Plot Updates

Even with faster plotting, we noticed an issue:

  • All plots were still being refreshed when the app started.
    1. Filters were first initialized with empty choices, and charts were initially rendered using the complete data
    2. Filter choices were updated using values in the data
    3. Updating the filter choices triggered reactivity on server to re-render the charts
  • Since the updated filters had all choices selected, the data remained the same, but the plots still re-rendered unnecessarily one time.

To fix this, we ensured that plots were only updated when filters actually changed the data: a simple reactiveValue was used to detect when a filter changed for the first time.

This cut our load time even further, from 6 seconds to 3 seconds.

Bonus: Custom JavaScript for Better Performance

We also explored using custom JavaScript to manage plot updates more efficiently. By handling certain UI interactions on the front end instead of Shiny’s reactive backend, we reduced unnecessary data transfer and improved responsiveness. The echarts API is very useful when you want to manipulate the plot without rendering it again: changing colors, opacity, line marks and so on.

Tired of slow Shiny apps? Learn how advanced caching techniques can significantly boost performance.

Key Takeaways: How to Optimize Shiny App Performance

  • Choose the right visualization library – ECharts4r is a great alternative to Plotly for large-scale apps.
  • Avoid unnecessary renders – Don’t refresh plots unless final result actually changes.
  • Consider frontend optimizations – Use JavaScript or Shiny proxies  to reduce the load on Shiny server and avoid the expensive re-rendering of outputs.

By making these simple changes, we cut our load time by 90 percent, from 30 seconds down to just 3 seconds.

If you’re struggling with slow Shiny apps, start by profiling performance, optimizing reactivity, and choosing the right tools.

Want to make your Shiny apps blazing fast? Check out our best practices for improving speed and performance.

What’s Next?

Do you have a Shiny app that could benefit from similar optimizations? Let us know what challenges you’re facing; we’d love to hear your experiences.

Have questions or insights?

Engage with experts, share ideas and take your data journey to the next level!

Is Your Software GxP Compliant?

Download a checklist designed for clinical managers in data departments to make sure that software meets requirements for FDA and EMA submissions.

Ensure Your R and Python Code Meets FDA and EMA Standards

A comprehensive diagnosis of your R and Python software and computing environment compliance with actionable recommendations and areas for improvement.
Explore Possibilities

Share Your Data Goals with Us

From advanced analytics to platform development and pharma consulting, we craft solutions tailored to your needs.

Talk to our Experts
shiny