Fedora 41 Looks To "-O3" Optimizations For Its Python Build

Written by Michael Larabel in Fedora on 13 April 2024 at 06:27 AM EDT. 30 Comments
FEDORA
A change proposal has been filed for building the CPython interpreter and the Python standard library using the "-O3" compiler optimization flag rather than Fedora's imposed default of the "-O2" optimization level. This is being sought in the name of greater Python performance on Fedora 41.

Red Hat engineer Miro Hrončok laid out the change proposal for compiling Fedora 41's Python package using -O3 rather than -O2. This matches upstream Python's release builds going for -O3 while -O2 is just used on Fedora per the distribution's default mandate.

By using -O3 rather than -O2, the Fedora Python package was found to deliver 1.04x the performance overall but in some particular micro-benchmarks was as much as 1.08~1.16x the -O2 performance.

Python logo


The only possible downside expressed so far is the possibility of a slightly larger Python package but the disk space increase using the -O3 optimization level should be less than 2%.

Overall it's a sane change for bettering the Python performance on Fedora. This F41 change proposal still needs to clear the Fedora Engineering and Steering Committee (FESCo) but those interested in the current plans can find them via the Fedora Wiki.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week