New submission from STINNER Victor <vstin...@python.org>:

Link Time Optimization (LTO) and Profile-Guided Optimization (PGO) have a major 
impact on Python performance: they make Python between 10% and 30% faster 
(coarse estimation).

Currently, macOS installers distributed on python.org are built with Clang 6.0 
without LTO or PGO. I propose to enable LTO and PGO to make these binaries 
faster.

IMO we should build all new Python macOS installers with these optimizations.

Attached PR adds the flags.


Python 3.9.0b3 binary:

$ python3.9
Python 3.9.0b3 (v3.9.0b3:b484871ba7, Jun  9 2020, 16:05:25) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

configure options:

>>> import sysconfig; print(sysconfig.get_config_var('CONFIG_ARGS'))
'-C' '--enable-framework' '--enable-universalsdk=/' 
'--with-universal-archs=intel-64' '--with-computed-gotos' '--without-ensurepip' 
'--with-tcltk-includes=-I/tmp/_py/libraries/usr/local/include' 
'--with-tcltk-libs=-ltcl8.6 -ltk8.6' 'LDFLAGS=-g' 'CFLAGS=-g' 'CC=gcc'

Compiler flags:

>>> sysconfig.get_config_var('PY_CFLAGS') + 
>>> sysconfig.get_config_var('PY_CFLAGS_NODIST')
'-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic 
-DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g-std=c99 -Wextra 
-Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers 
-Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  
-I/Users/sysadmin/build/v3.9.0b3/Include/internal'

Linker flags:

>>> sysconfig.get_config_var('PY_LDFLAGS') + 
>>> sysconfig.get_config_var('PY_LDFLAGS_NODIST')
'-arch x86_64 -g'

----------
components: Build
messages: 372743
nosy: vstinner
priority: normal
severity: normal
status: open
title: [macOS] Build macOS installer with LTO and PGO optimizations
type: performance
versions: Python 3.10, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41181>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to