interpreters/python: Optmize Python for size#3542
Merged
acassis merged 1 commit intoJun 16, 2026
Merged
Conversation
This aims to reduce Python's library size. Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
xiaoxiang781216
approved these changes
Jun 15, 2026
linguini1
approved these changes
Jun 16, 2026
jerpelea
approved these changes
Jun 16, 2026
Contributor
|
+1 from me, out of lab ;-)
…--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
|
eren-terzioglu
approved these changes
Jun 16, 2026
acassis
approved these changes
Jun 16, 2026
Contributor
Author
|
Anything else? Can it be merged? |
Contributor
Please change later the OPT to use the defined optimization from NuttX config or open an issue to track it if you cannot work on it for now |
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.
Summary
Reduce general firmware size by optimizing Python-related sources.
Impact
Impact on user: Yes. Enable reducing firmware size when
CONFIG_INTERPRETERS_CPYTHONis enabled.Impact on build: Yes. Reduce firmware size by ~6% (tested on ESP32-P4)
Impact on hardware: No.
Impact on documentation: No.
Impact on security: No.
Impact on compatibility: No.
Testing
Build
esp32p4-function-ev-board:pythondefconfig before and after applying this patch.Building
Running
After flashing the device, just run
pythonon NSH to ensure that it's being properly initialized.Results
Comparison between the firmwares built before and after applying this patch:
Before
And the final firmware size:
After
And the final firmware size: