Open ehmatthes opened 10 months ago
Looking at size of pricer.df
, it's ~190kB no matter how many platforms are deselected. Only define, fill, and use parts of the df that are going to be visible on the page.
After this work, dashboard starts with only two platforms selected. Uses ~92kB, instead of 190kb. Dropping to one platform -> 57kb. No platforms -> 23.0kb.
fig.to_json()
.persist=True
makes cache dir appear.)cache_data(ttl=180)
on each poorly get_plot()
function. This works, as evidenced by cache directory showing up.get_plot()
checks num_users, if 10k, call cached function, if not call uncached function. Both of these call the same plotting function.
The app did not handle a little Show HN attention well (429), so look at a little optimization. But for a bunch of users, it might need a different deployment approach.
python -m cProfile pricer.py
)