Problem
The Streamlit dashboard currently feels slow and occasionally “jumpy” due to full script reruns, repeated data fetching, and heavy computations being triggered more often than necessary.
Impact
- UI interactions (dropdowns, toggles) trigger full reruns, causing visible lag
- Expensive operations (news fetch, price fetch, signal computation) may run more frequently than needed
- Background scan + UI refresh logic can feel inconsistent or non-smooth
- Overall user experience is not fluid, especially on slower machines or networks
Context
The dashboard relies heavily on Streamlit’s rerun model and caching:
- Cached functions (
@st.cache_data) are used, but invalidation is still broad
- Background scan logic runs alongside UI updates
- Multiple data sources (price, news, metrics) are fetched and processed per interaction
Relevant code areas:
dashboard.py (caching, rerun flow, background scan logic)
app.py (heavy computation pipeline)
Suggested Improvements
1. Reduce unnecessary recomputation
- Ensure expensive functions are only called when inputs actually change
- Avoid recomputing full pipelines on simple UI interactions
2. Improve caching strategy
- Review TTL values for price and news caching
- Separate cache layers (e.g., raw data vs processed metrics)
- Avoid clearing all cache on minor refresh actions
3. Decouple UI from heavy processing
- Use precomputed scan results (
scan.py) where possible instead of recomputing live
- Load from stored snapshots instead of recomputing per render
4. Optimize background scan interaction
- Ensure scan status updates do not trigger unnecessary UI reruns
- Avoid lock contention or redundant thread triggers
5. Improve perceived performance
- Add loading placeholders/skeletons where appropriate
- Avoid blocking UI while background tasks run
Acceptance Criteria
- Dashboard interactions feel smooth (no noticeable lag on dropdown changes)
- No redundant recomputation of heavy functions during simple UI updates
- Cached data is reused effectively
- Background scan runs reliably without affecting UI responsiveness
Notes
- This is primarily a performance and UX improvement issue
- Focus on practical gains, not premature optimization
- Avoid introducing complex state management unless clearly justified
Contributions and ideas welcome.
Problem
The Streamlit dashboard currently feels slow and occasionally “jumpy” due to full script reruns, repeated data fetching, and heavy computations being triggered more often than necessary.
Impact
Context
The dashboard relies heavily on Streamlit’s rerun model and caching:
@st.cache_data) are used, but invalidation is still broadRelevant code areas:
dashboard.py(caching, rerun flow, background scan logic)app.py(heavy computation pipeline)Suggested Improvements
1. Reduce unnecessary recomputation
2. Improve caching strategy
3. Decouple UI from heavy processing
scan.py) where possible instead of recomputing live4. Optimize background scan interaction
5. Improve perceived performance
Acceptance Criteria
Notes
Contributions and ideas welcome.