Bug 1749479

Summary: Build Python3 to statically link with libpython*.a for better performance
Product: [Fedora] Fedora Reporter: dagray
Component: python3Assignee: Charalampos Stratakis <cstratak>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, dmalcolm, m.cyprian, mhroncok, pviktori, rkuska, shcherbina.iryna, slavek.kabrda, tomspur, torsava, vstinner
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-26 14:19:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description dagray 2019-09-05 17:44:06 UTC
Fedora Python 3 performance could be improved by ~15% by building /usr/bin/python* to statically link with a libpython*.a rather than dynamically with libpython*.so. This can be done by removing --enable-shared from the configure arguments. The libpython*.so can be built separately and included in the rpm, or as a separate package.

The value of PGO and LTO is diminished significantly by using --enable-shared in the build.

PyBench and PyPerformance results both improved by about 15% on average in my experimental builds on Fedora.

PyBench results: (average)
Fedora 30 stock python3.6 : 2001 ms
Fedora 30 python3.6 build from src without --enable-shared: 1709

Comment 1 Miro Hrončok 2019-09-20 13:40:16 UTC
Experimental PR: https://src.fedoraproject.org/rpms/python3/pull-request/133

Comment 3 Petr Viktorin (pviktori) 2019-11-26 14:19:15 UTC
The speedup can be had using the -fno-semantic-interposition flag, a much less invasive change.
It is now tracked as a Fedora Change: https://fedoraproject.org/wiki/Changes/PythonNoSemanticInterpositionSpeedup