-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
python3: enable optimizations. #43791
python3: enable optimizations. #43791
Conversation
Sorry for the delay. I don't really have a problem with enabling optimizations; if they improve runtime performance, we can pay the price in compile time. The question is how much PGO makes improves things for the average user if the optimization is tailored to the build system. I'd like to test a few things, including building on different CPUs to see how well the optimizations translate. |
As a data point, I built this on my box (i7-9700). Running the sagemath testsuite with this (in the same box) takes ~5% less time to complete. As in 12:00 vs 12:30 for the normal test, and 23:17 vs 24:40 for the long test using 8 threads. |
ee7cb61
to
eb0b729
Compare
I built this PR on a Zen 3 CPU and ran a test that built a sparse finite-element matrix and then used SuperLU to performan LU factorization. Although the SuperLU performance won't change, the setup does some heavy looping in Python and the overall time for the routine dropped from 2.78 sec to 2.3 sec, each trial averaged over several runs. I installed the Zen-built package on another system with a 9th-generation Intel CPU and re-ran the same test, with the times dropping from 3.7 sec to 2.75 sec. It seems these optimizations offer tangible benefits, and they translate to different systems. |
Just for the record, the sagemath (10.1.rc0) testsuite with
After updating to
That's a neat 5-10 % speedup! Thanks! |
Closes: void-linux#43791 [via git-merge-pr]
This
--enable-optimizations
flag enables profile-guided optimizations (PGO) and link-time optimization (LTO, but apparently only sometimes, depending on the platform). My rudimentary benchmarking indicates that compared to python3 from the repos, python3 built from this PR yielded performance improvements of around 10%-12% (I tried building python3 from master locally, but that one had horrendous performance for some reason). I'm not a benchmarking expert though, so I wanted others to try out their own benchmarks and post their results here.On my potato laptop, this change tripled build time from 5 minutes to 15 minutes. I don't think this is an issue however because changes to the python3 template are not done often (averaging once per month in the last 12 months), and the builders are much beefier than my laptop, so their build times will be even shorter anyway.
TODO:
python3-tkinter
? (I don't think so, but better check)Testing the changes
@ahesford