-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
JupyterViz: Simulation step is very slow for huge grid size (e.g. 80x80) #1806
Description
This is a continuation of the discussion started in #1772 (comment).
@rlskoeser suggested Altair, which might be faster than Solara's Matplotlib backend.
I did manual benchmark. I found that on my laptop (i5-1345U), the portray generation and ax.scatter took 80 ms, but the slowest part is actually Solara's savefig: https://github.com/widgetti/solara/blob/a747a680478653ab73c3f9323aeb5fee45147b60/solara/components/matplotlib.py#L54, which took 1.2 s.
I changed the output format from png to svgsvg to png, and the savefig elapsed went down from 1.2 s to 180 ms. I additionally experimented with updating the scatter plot with set_offsets (for x, y), and set_sizes for size: the portrayal generation and scatter update went down from 80 ms to 6 ms. The branch I used to experiment can be found at https://github.com/rht/mesa/tree/solara_perf.
This is very promising.