py/makeqstrdefs.py: Gzip the qstr.i.last generated output.#19312
Draft
dpgeorge wants to merge 1 commit into
Draft
py/makeqstrdefs.py: Gzip the qstr.i.last generated output.#19312dpgeorge wants to merge 1 commit into
dpgeorge wants to merge 1 commit into
Conversation
Generated `qstr.i.last` files can be very, very large due to inclusion of large HAL headers. The data is very repetitive text so compressing it can significantly reduce the size of the file, and hence reduce the size of the build directory and decrease wear of the filesystem. With a clean build from scratch, using gzip level 1 changes the build output by the following amounts: - stm32 PYBV10: 130M -> 48M (`qstr.i.last` reduced by 82M) - rp2 RPI_PICO: 85M -> 47M (`qstr.i.last` reduced by 38M) - esp32 ESP32_GENERIC: 304M -> 244M (`qstr.i.last` reduced by 60M) This can amount to significant savings when building all boards for a port, eg saving up to 6GB building all stm32 boards. It saves less on a rebuild because `qstr.i.last` only contains preprocessor output from files that changed since the previous build. Built time is increased slightly due to the compression: about 0.5-1 second slower (out of a total 30s build time, which includes 4s generating `qstr.i.last`) for stm32 PYBV10, which is around 3% slower. Using `compresslevel=9` saves about 2M more but almost doubles the time taken to generate `qstr.i.last` (going from 4s up to 8s or more). So using `compresslevel=1` is the best trade off here. Signed-off-by: Damien George <damien@micropython.org>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19312 +/- ##
=======================================
Coverage 98.47% 98.47%
=======================================
Files 176 176
Lines 22845 22845
=======================================
Hits 22497 22497
Misses 348 348 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Code size report: |
Member
Author
|
Oh, the windows builds have a special processing step |
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
Generated
qstr.i.lastfiles can be very, very large due to inclusion of large HAL headers. The data is very repetitive text so compressing it can significantly reduce the size of the file, and hence reduce the size of the build directory and decrease wear of the filesystem.With a clean build from scratch, using gzip level 1 changes the build output by the following amounts:
qstr.i.lastreduced by 82M)qstr.i.lastreduced by 38M)qstr.i.lastreduced by 60M)This can amount to significant savings when building all boards for a port, eg saving up to 6GB building all stm32 boards.
It saves less on a rebuild because
qstr.i.lastonly contains preprocessor output from files that changed since the previous build.Built time is increased slightly due to the compression: about 0.5-1 second slower (out of a total 30s build time, which includes 4s generating
qstr.i.last) for stm32 PYBV10, which is around 3% slower.Using
compresslevel=9saves about 2M more but almost doubles the time taken to generateqstr.i.last(going from 4s up to 8s or more). So usingcompresslevel=1is the best trade off here.Testing
Tested building the above ports and measured output size.
CI will test the rest.
Trade-offs and Alternatives
Costs a small amount of time to compress/decompress, but using level 1 keeps this time down to a minimum.
The
qstr.i.lastdata is no longer readable in an editor, without first decompressing it (which is pretty easy to do if you ever need to view this data).Generative AI
Not used.