-
Notifications
You must be signed in to change notification settings - Fork 17
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
Dependency compilation improvements #468
Comments
We should also consider using the |
Great investigation and write-up. Adding my two cents here.
I have no experience with link-time-optimization in general, but I suspect smaller image sizes would be valued more highly. I think any users that need that level of control over the python interpreter will likely be using a custom builder and ensuring compilation dependencies are present. I hope this is helpful. |
Using
|
This will be partially addressed in #476 |
This was also partially addressed in #478 |
There are some improvements we should make to the way we compile python.
--enable-optimizations
for some versions of Cpython. This flag improves run-time performance by about 10% (according to the internet) at the expense of longer compile times. It is enabled on every common pre-built python binary (e.g. the python distributed by Canonical, the Python Docker images maintained by Docker, etc).3.7.x
have a very large test suite which takes a long time to run (often over an hour). Newer versions have a smaller test suite which takes more like 5-10 minutes to run. We should evaluate this flag for each version of Cpython, and only enable it when it does not make the build take too long.3.11.0
)make -j$(nproc) LDFLAGS="-Wl,--strip-all"
make -j
speeds up build time by a minute or twomake install
step as-is - it does not benefit from parallelization.3.11.0
we see this output during the compilation step:Additionally, we should evaluate the
--with-lto
flag in conjunction with--enable-optimizations
. In principle, link-time optimization (LTO) should improve run-time performance with minimal impact to build duration and a slight increase in file size. I have seen this on other languages like Rust. However, preliminary investigation for Cpython shows that this makes the build much slower (typically 5-10x slower than just using--enable-optimizations
for Cpython3.11.0
), and it significantly increases the resultant filesize (we observed about 50% increase for Cpython3.11.0
).The text was updated successfully, but these errors were encountered: