One st.write() vs. multiple dedicated methods (Performance)

Dear devs,

Do you know of any performance drawbacks when putting multiple markdown paragraphs and charts into a single st.write() method call? Compared to spreading them out to several st.text() and st.altair_chart() calls? Any suggestion for best practices here?

Hey @jan-scorl - we don’t have any best practices around that, and in theory they should be the same, performance-wise.

st.write() does some type-checking on each of its arguments to figure out which function to route that arg to, but this should not add meaningful overhead to your app. Are you seeing performance issues?

1 Like