Repository navigation
bit_world: draw without making an Area per shape - #195
Conversation
Bit World never reads the Area a pygraphics drawing call returns, so its pygraphics frames ask for none (FrameBuffer areas=False, pygraphics#104). On MicroPython that removes the garbage left by text, alpha glows and large copies. A pygraphics without the keyword returns them as before. On unix MicroPython with pygraphics#105, update, sound and repaint into two alternating 800x480 buffers allocate, per frame: Workshop 983 -> 498 bytes, Sky Ruins 587 -> 414, Cyber-Deck 762 -> 528. tests/repaint_check.py prints bad 0 at 800x480, and the CPython tests pass with the released pygraphics (the fallback) and with pygraphics#105. Refs #189
|
Measured on the ESP32-S31 4.3 inch RGB board, bit_world for 70 s each (direct mode, drawing into the panel's two buffers):
So the Area change takes about 400 bytes a frame off bit_world, the cached That length comes from the pixel buffers. On the same board, after a fresh boot, |
bit_world draws hundreds of shapes a frame, and every pygraphics drawing call used to hand back a new
Area, 32 bytes each on MicroPython. The app never reads them, so its canvases now ask pygraphics not to make them (FrameBuffer(..., areas=False), from PyDevices/pygraphics#105). With a pygraphics that doesn't know the keyword yet,gfx_frame()falls back to the plain constructor, so the app runs the same on every release.On unix MicroPython at 800x480, bytes allocated per frame drop from 983 to 498 in the Workshop, 587 to 414 in Sky Ruins and 762 to 528 in the Cyber-Deck. What's left is mostly float maths in the acts.
repaint_checkstill finds every frame identical to a full repaint (885 fast frames, 0 bad), and the CPython tests pass with the released pygraphics and with the branch.The board numbers are in the comment below.
Refs #189