-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove '__version__' and '__repo__' to save RAM #95
base: main
Are you sure you want to change the base?
Conversation
Does this work with circup still? I think circup uses this info to map back to a package but I could be wrong. |
We do need the version somewhere so it can be read by code, but mostly tools like circup for updates. The repository URL is read in circup, if present, but used only in one place, when warning that a module has a bad version number, adding Also, if we do any of that, it's worth looking at making it a policy across the whole bundle. |
Not sure if that's relevant, but from what I've seen in the bundle, the presence of these two symbols is quite inconsistent. For instance it's absent from
In my opinion, some root-level What do you think of embedding these in the comments, beneath the SPDX license lines?
I was wondering, is there a place to discuss issues that affect the whole bundle or multiple packages at once? |
Yeah I agree.
Comments are deleted from mpy files. And actually I think other libraries might want to check the version. So I don't think we can avoid having the version in memory once. But getting rid of the URL and duplicate version strings would be nice for M0 boards when that matters.
The standard way would be to open an issue in the Circuitpython library with the |
This could be a good topic to discus in the weeds during a meeting as well. |
As said in the title, this removes the
__version__
and__repo__
symbols from all modules to save up on RAM.During my testing on an Feather RP2040 CAN, I was able to save 2.5 kB of that precious RAM in a worst-case scenario (= all modules being imported). This represents almost 1% of that MCU's total amount.
Notes: to get the numbers below, I applied the same optimization to Adafruit_CircuitPython_imageload, on which this module depends, and all the libraries were compiled to
.mpy
beforehand usingmpy-cross
v9.2.1, which is the exact CP version that my board is running.Code used to test:
results: