Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cache not fragment #51

Open
swo opened this issue Dec 20, 2024 · 1 comment
Open

Use cache not fragment #51

swo opened this issue Dec 20, 2024 · 1 comment

Comments

@swo
Copy link
Contributor

swo commented Dec 20, 2024

To make it so that viewing different per-simulation results did not re-run all the simulations, I used st.fragment, so that the graph viz would be separated from the rest of the app.

Probably what we want instead is to cache the results of the simulations: https://docs.streamlit.io/develop/concepts/architecture/caching

Then we could have other adjustments to the viz that are all downstream of the simulation, without wrapping each one in a fragment.

Conceptually I think it makes more sense to cache than to fragment.

There is a "max cache size" option, which could become important, if someone drags sliders around. Although I don't know how many simulations it would take to produce any meaningful length of output.

@afmagee42
Copy link
Contributor

Fragment is confusing to me, while caching makes sense. So I endorse this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants