From d994dffce14996de95e051ced242b6babc88b50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B8=B8=EC=9E=AC=EC=9D=80?= Date: Sun, 13 Aug 2023 21:53:45 +0900 Subject: [PATCH] Document PGO builds (#1153) Co-authored-by: Alex Waygood Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- getting-started/setup-building.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index 60db82d47d..e91ee07b8f 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -237,6 +237,27 @@ build the :py:mod:`ctypes` module (without the flag the rest of CPython will still build properly). +Optimization +'''''''''''' + +If you are trying to improve CPython's performance, you will probably want +to use an optimized build of CPython. It can take a lot longer to build CPython +with optimizations enabled, and it's usually not necessary to do so. However, +it's essential if you want accurate benchmark results for a proposed performance +optimization. + +For an optimized build of Python, use +``configure --enable-optimizations --with-lto``. +This sets the default make targets up to enable Profile Guided Optimization (PGO) +and may be used to auto-enable Link Time Optimization (LTO) on some platforms. +See :option:`python:--enable-optimizations` and :option:`python:--with-lto` +to learn more about these options. + +.. code:: console + + $ ./configure --enable-optimizations --with-lto + + .. _windows-compiling: Windows