-
Notifications
You must be signed in to change notification settings - Fork 63
Description
Perhaps I'm using the API wrongly, but what I am trying to do is to do some kind of object pooling, having many image graphics pre-initialized since I need to use them as some sort of dynamic thumbnails that show up as the user pans and zooms around, as it is much quicker to just set the data and position on the fly compared to adding a new image graphic, and I will have many of these responding to user interaction, so it needs to be responsive.
I noticed however that as I am initializing more images in the figure, the amount of time it takes to add a new image graphic increases a lot.
I've made a minimal example using imageio and tqdm to illustrate this:
import fastplotlib as fpl
import imageio.v3 as iio
from tqdm import tqdm
img = iio.imread("imageio:astronaut.png")
figure = fpl.Figure()
for x in tqdm(range(2000)):
figure[0, 0].add_image(img)
figure.show()
fpl.loop.run()Over time, the iterations per second eventually drops to low single digits. This makes the pooling take very long.
This is with fastplotlib 0.6.0, CPython 3.13.5, Windows 11.