Evaluating the efficiency of streamlit and functools caching for pandas and polars. The outcomes will shock you!
Streamlit is my default framework for constructing each proof-of-concept demos and analytical dashboards. The simplicity of the framework permits fast improvement and simple upkeep. Nevertheless, the darkish aspect of simplicity is that it comes with in-built design assumptions that make it tough to make use of as a prime grade manufacturing device. We’ll cowl these intimately later, however the results of these assumptions is how gradual Streamlit might be when processing and rendering your app.
On this put up, I need to present you 2 strategies to extend the velocity of your Streamlit apps: utilizing the built-in Streamlit caching features and utilizing the built-in functools caching features. Each strategies are anchored on the thought of caching, the place, if one thing has already been triggered earlier than, the output is saved to re-use later.
Earlier than stepping into the outcomes, I really feel it is very important perceive 3 primary items of idea: how does Streamlit, Streamlit caching, and functools caching work underneath the hood.
PS: All photos are authored by me, until in any other case specified.