adafruit / Adafruit_CircuitPython_RGB_Display

Drivers for RGB displays for Adafruit CircuitPython.
MIT License
131 stars 52 forks source link

Animated Gif Player Performance improvements #61

Closed makermelissa closed 4 years ago

makermelissa commented 4 years ago

I mostly want to list ideas here for performance improvement ideas. The first idea I had is taking the image loading time into account for the delay. At the moment it loads the images, then does a delay. This change should have a significant impact.

ladyada commented 4 years ago

good idea, time.monotonic() ftw :)

makermelissa commented 4 years ago

time.monotonic is now implemented. I'll keep this open for a while longer to continue listing ideas.

philippkeller commented 4 years ago

A side note on speed improvements: I first tried this repo without numpy installed and a call to image() lasted around 0.58s, I nearly gave up, until I saw the if/else around numpy in the image function. After installing numpy it only took 0.075s so this is almost 8x as fast as without numpy.

IMO you could/should output a warning when numpy is not available as I was almost giving up this repo because of speed issues.

ladyada commented 4 years ago

@philippkeller we should import numpy in the main script to 'force' it to install, wanna submit that as a PR?

makermelissa commented 4 years ago

I also added a section to the guide the other day suggesting NumPy be installed installed in the setup, but I like the suggestion of just adding an unused import.

makermelissa commented 4 years ago

I think I'm going to close this. I was able to run this at a good speed on the Pi 4. The latest SPI addition in PureIO really helped and the code is pretty optimized at this point.