📦 Make release builds compile very optimized#1586
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes yarl's C-extension builds by introducing build mode differentiation and allowing user-defined compiler flags. In release mode, extensions are compiled with maximum optimization and minimal debug information for smaller binaries and better performance. In debug mode (when line tracing is requested), comprehensive debugging symbols and coverage instrumentation are included.
- Implements conditional compiler flags based on build mode (debug vs release)
- Enables user override of CFLAGS and LDFLAGS through environment variables
- Adds visual feedback showing which build mode is active
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packaging/pep517_backend/_cython_configuration.py | Implements three-tier flag priority system and mode-specific optimization flags |
| packaging/pep517_backend/_backend.py | Adds console output to display current build mode |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1586 +/- ##
==========================================
- Coverage 99.60% 99.57% -0.04%
==========================================
Files 29 29
Lines 5835 5853 +18
Branches 266 266
==========================================
+ Hits 5812 5828 +16
- Misses 19 21 +2
Partials 4 4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b321d3e to
101826c
Compare
CodSpeed Performance ReportMerging #1586 will not alter performanceComparing Summary
Footnotes |
This patch improves the in-tree build backend to allow the end-users append `CFLAGS` and `LDFLAGS` by setting respecitve environment variables. It additionally sets up default compiler flags to perform build with maximum optimization in release mode. And when line tracing is requested, the compiler and linker flags are configured to include as much information as possible for debugging and coverage tracking. As a result, the C-extensions published to PyPI are going to be small while their development/testing environment variants will be big.
It appears that GCC supports them but Clang does not.
3776944 to
b96edd2
Compare
|
Alright.. Looks like it's time to compose a change note, now that the metrics are roughly what we expected. |
|
To ensure it's here too: this breaks ~all Linux distributions where we want to build moderately optimised binaries with debug symbols, and split the symbols out ourselves. I filed #1592 with further details. |
This patch improves the in-tree build backend to allow the end-users append
CFLAGSandLDFLAGSby setting respecitve environment variables.It additionally sets up default compiler flags to perform build with maximum optimization in release mode. And when line tracing is requested, the compiler and linker flags are configured to include as much information as possible for debugging and coverage tracking.
As a result, the C-extensions published to PyPI are going to be small while their development/testing environment variants will be big.
Are there changes in behavior for the user?
yarl's footprint is smaller, and it should run faster.
Checklist