Closed achimstruve closed 10 months ago
@achimstruve how are you identifying those numbers? I went though the article and I am not sure if it helps. I am going to keep researching but having the way you got those numbers will be helpful
We could potentially cache the simulation and run it in the background I am just not sure if that actually solves the problem. I think the size of the data we are pulling seems like its probably an issue too.
I literally took my phone and stopped the times manually from clicking on the button until the simulation finished. Note that those times might be different on your local machine.
Cached data is only helpful if we work with pre-processed data, such as stated in issue #45.
The blog post section 3 is talking about "..., bring your model and other assets to the production machine, and you can get orders-of-magnitude better startup time." I am wondering if this can help us.
instead of running the file as a sub process + script I just called it as a function. Timing should be good now.
@BlockBoy32 not sure why, but for me the simulation now takes for ever (>5 min). Could you clear your cache and see if it is still solved?
It was working for me, could it be with that new push that @alex put in?
I am also now getting a new pool error? Not sure if thsts just local to my device right now
When I run the ./Model/tests/test_stage.py
everything runs fine as before. So all the changes from @alex-damjanovic should be good. Also I went through all of his changes and there was nothing that will impact the performance or logic of the model.
@achimstruve I am still struggling with this speed issue, I created a panel app to see if it was a streamlit but getting the same slow speed when I click the button to run the simulation. Its just weird because when I encode a timer on the interface it outputs 10-11 seconds but visually its a minute. If we have any talent with front end experience it would be extremely helpful.
I just created one simple UI interface with dash plotly but it is even slower than streamlit. On my machine it requires 71s to run the simulation + post processing vs. 43s with streamlit.
Now I built a minimalistic streamsync app app to test the simulation + post processing duration. It requires 66s on my machine and is therefore a bit faster than dash plotly, but still slower than streamlit.
I can push my panel app if you want but its around the same time frame. its just weird because when I time the interface on the on actual app.py it shows it as super quick. So could it maybe be a rendering thing? I feel like if we had someone who understood front ends and could lend advise this could be a very quick fix for something that we are overlooking. I even tried to use the dev tools and still couldnt figure it out
The introduction of if-statements before for-loops over agents brought a slight improvement to the simulation time in pure python console testing. However, there is no real performance improvement for the streamlit UI.
Also I tried to remove any database operations in a dedicated test run. This didn't change anything as well.
Here are the current stats on my local machine for different simulation configurations via streamlit UI:
This means that it is the simulation itself that requires so much computational load via streamlit.
I created a new streamlit forum post on the UI performance, but no one answered, yet.
I close this issue for now as we don't have any tangible items left that we can work on to improve the UI performance further.
On my machine a 60 months simulation takes 12s and a 120 months simulation takes 19s, which is okay for the current state of the project.
I did some performance tests in our streamlit interface with the following results:
Run empty script: <1s Simulation only: 33s Simulation + Postprocessing: 43s
This clearly shows that the calculation work is somehow done in streamlit, which makes it quite slow compared to the pure Python execution.
This streamlit blog talks about different tips to improve the streamlit performance. Someone can read this to see how we can apply them.
In this issue we can discuss/collect all UI performance related topics.