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
python: enable optimizations #43442
python: enable optimizations #43442
Conversation
Failure on x86_64-darwin (full log) Attempted: python Partial log (click to expand)
|
This should go to staging. |
Failure on x86_64-linux (full log) Attempted: python Partial log (click to expand)
|
Failure on aarch64-linux (full log) Attempted: python Partial log (click to expand)
|
Have you considered enabling LTO as well? https://hg.python.org/cpython/file/3.6/configure.ac#l1287 |
We would have to test against the package set to see if it does not have any unwanted side-effects. |
How much more time does it take to build the different Python versions? |
Failure on x86_64-darwin (full log) Attempted: python Partial log (click to expand)
|
Failure on x86_64-linux (full log) Attempted: python Partial log (click to expand)
|
Failure on aarch64-linux (full log) Attempted: python Partial log (click to expand)
|
@FRidh I tested this with the dependency tree of a project as a sanity check and didn't notice any problems. -nix-build -A python27 --check 0.17s user 0.08s system 0% cpu 1:39.95 total
-nix-build -A python36 --check 0.19s user 0.10s system 0% cpu 1:34.19 total
+nix-build -A python27 --check 0.19s user 0.09s system 0% cpu 15:40.69 total
+nix-build -A python36 --check 0.23s user 0.12s system 0% cpu 28:26.26 total |
I wonder... do you care for this for 18.09? (I can't really afford to review it myself.) |
I reread the description of the flag and I'm not actually sure anymore if it's useful. I mainly tried this out because the build log recommends it for a release build.
|
It seems we're good on that since Will merge in a few days if there's no disagreement. |
So I imagine it's not as much of a problem in practice but I can't help but be a little uncertain about PGO'ing python using a test-suite that experiences failures (which I'm seeing on at least 3.7 and probably others). Note that apparently the tests failing is not a build-breaker, but it does make one wonder.... what exactly are optimizing towards? 🙁 On a related note, anyone know what sort of performance benefits this gives (on whatever metrics you like)? Is it known to cause regressions in certain areas? (Presumably not many of importance since. as you say, this flag is recommended when not specified...) This is all about optimizing the python interpreter itself, yes? Are there similar options / capabilities for optimizing (or pre-compiling bytecode at all) python packages/modules as well? |
At least when building the interpreter we also build optimized bytecode. We could do that as well in a hook for all Python packages. I don't think we should bother with these optimizations. If you indeed have something critical running, then likely you know about the option and enable it. |
This is a rather difficult proposal since it means rebuilding a lot of packages that depend on Python. FWIW I've just run |
Motivation for this change
I didn't perform any tests yet, but I assume it's pretty safe and hopefully makes some stuff a bit faster.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)