randyzwitch / streamlit-folium

Streamlit Component for rendering Folium maps
https://folium.streamlit.app/
MIT License
468 stars 176 forks source link

fig.render() is used several time in a row for st_folium #143

Closed BastienGauthier closed 1 year ago

BastienGauthier commented 1 year ago

I did not succeed in testing locally on my side (not sure how to deal with the _component_func), but I figured that with v0.14 version of st_folium, the main computation time is used with my use case by the "fig.render()" folium function.

This is used twice in the process of the map creation :

Given these two functions are used only once in the init, would it be possible to mutualize the render only once on folium_map, before calling these to function ? This could improve performance drastically (once again !)

BastienGauthier commented 1 year ago

@randyzwitch or @blackary, by chance, do you have any tutorial on how I can follow so I can test the package locally before any PR ?

randyzwitch commented 1 year ago

(Doing this from phone, sorry for not direct linking)

If you go to the .github directory, you’ll see how we run the tests for each pull request. Basically, you pip install (-e if I’m not mistaken to install globally) then run the tests

BastienGauthier commented 1 year ago

Thanks for the precision ! I had some trouble compiling (tried v18 instead of v16...), but I could made a proposition. I have seen no regression and I a very significative performance improvement. I hope you will like it !