Repository navigation
Bit World: frames and sprites outside the heap where the firmware has offheap - #198
Merged
Merged
Conversation
… offheap The three full-screen backgrounds (2.3 MB at 800x480) and the sprite atlas were bytearrays, and MicroPython's collector reads every word of them, so each collection stopped the picture for 200-360 ms on an ESP32-S31. pixel_bytes() makes an offheap.Buffer where the firmware has offheap, and a bytearray everywhere else (CPython, CircuitPython, older firmware), where MicroPython also says why collections will pause.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bit World's three full-screen backgrounds (2.3 MB at 800x480) and its sprite atlas now come from
pixel_bytes(), which makes anoffheap.Bufferwhere the firmware has theoffheapmodule (PyDevices/omnipython-builds#602) and a bytearray everywhere else (CPython, CircuitPython, older firmware). The garbage collector no longer reads every word of them. On MicroPython withoutoffheap, Bit World prints one line saying collections will pause the picture.Measured on an ESP32-S31 4.3 inch 800x480 board, 70 s each, with the same firmware for both (#602's image):
gc.collect()with the app alivetests/repaint_check.pypasses on unix MicroPython built with offheap (800x480, every redraw matches a full draw, with the frames in Buffers), and the Bit World tests pass on CPython, where the frames stay bytearrays. The app's otherbytearrays are small and stay as they are.Refs #189.