Profiling & Best Practices

Hey! I have two semi-adjacent requests. First, if I have my app working, but working solely, is there any bult-in or recommended way to profile app performance? I am trying to understand core bottlenecks and speed it up.

Second, it would be wonderful to have a list of best practices and patterns using streamlit, e.g. how to keep and cache SQL connection so it won’t expire, or use async and sync pieces of the app together.