optimizing-streamlit-performance

Optimize Streamlit app performance by reducing reruns and unnecessary recomputations.

224|23|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/streamlit/agent-skills --skill optimizing-streamlit-performance-streamlit
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: optimizing-streamlit-performance
Source: https://github.com/streamlit/agent-skills/tree/main/developing-with-streamlit/skills/optimizing-streamlit-performance
Command: npx skills add https://github.com/streamlit/agent-skills --skill optimizing-streamlit-performance-streamlit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Performance bottlenecks in Streamlit apps come from unnecessary reruns, heavy data loads, and suboptimal rendering.

Core Features & Use Cases

  • Caching with st.cache_data and st.cache_resource to minimize recomputation and expensive connections.
  • Fragment isolation with st.fragment to limit reruns to small UI parts.
  • Forms and batching with st.form to improve UX and reduce churn during user input.
  • Safe caching practices (TTL, max_entries) and resource lifecycle management for production-grade apps.

Quick Start

Analyze a Streamlit app to identify bottlenecks and apply caching, fragments, and static-vs-dynamic widget choices to improve speed.

Frequently Asked Questions about optimizing-streamlit-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize Streamlit app performance by reducing unnecessary reruns?▼

To optimize Streamlit app performance, apply st.fragment for UI isolation, st.form for input batching, and st.cache_data to prevent unnecessary recomputations during reruns.

What is the best way to cache heavy data loads in Streamlit dashboards?▼

The best way to cache heavy data loads in Streamlit is using st.cache_data to minimize recomputation and st.cache_resource for expensive connections, applying TTL and max_entries for safe lifecycle management.

When should I use st.fragment to isolate UI components in Streamlit?▼

Use st.fragment to isolate UI components when you need to limit reruns to small parts of a data-heavy dashboard, preventing full app recomputation and improving overall rendering speed.

Can I use st.form to batch user inputs and reduce Streamlit reruns?▼

Yes, you can use st.form to batch user inputs in Streamlit, which reduces rerun churn by collecting multiple widget interactions and submitting them in a single execution cycle.

Why does my Streamlit dashboard rerun the entire app on every widget interaction?▼

Streamlit reruns the entire app on widget interactions by default; applying fragment isolation, static widget choices, and caching patterns restricts recomputation scope and resolves these performance bottlenecks.