Bug 1749479 - Build Python3 to statically link with libpython*.a for better performance
Summary: Build Python3 to statically link with libpython*.a for better performance
Alias: None
Product: Fedora
Classification: Fedora
Component: python3
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Charalampos Stratakis
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2019-09-05 17:44 UTC by dagray
Modified: 2019-11-26 14:19 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-11-26 14:19:15 UTC
Type: Bug

Attachments (Terms of Use)

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 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

Note You need to log in before you can comment on or make changes to this bug.