Is there a way to attach a profiler to a Streamlit app to detect which part of the code is running slowly? I suspect it is with one of my data processing functions, not with the Streamlit display itself.
If you havenβt done it yet, put all the code in your main file inside a main()
function. Then add code that calls the function using the profiler in the standard library:
import cProfiler
def main():
# your streamlit app here
...
if __name__ == "__main__":
cProfiler.run("main()")
Learn more about what you can do with the profiler and its output: