Skip to content

Commit d994dff

Browse files
KilJaeeunAlexWaygoodAA-Turner
authored
Document PGO builds (#1153)
Co-authored-by: Alex Waygood <[email protected]> Co-authored-by: Adam Turner <[email protected]>
1 parent 689528c commit d994dff

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

getting-started/setup-building.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,27 @@ build the :py:mod:`ctypes` module (without the flag the rest of CPython will
237237
still build properly).
238238

239239

240+
Optimization
241+
''''''''''''
242+
243+
If you are trying to improve CPython's performance, you will probably want
244+
to use an optimized build of CPython. It can take a lot longer to build CPython
245+
with optimizations enabled, and it's usually not necessary to do so. However,
246+
it's essential if you want accurate benchmark results for a proposed performance
247+
optimization.
248+
249+
For an optimized build of Python, use
250+
``configure --enable-optimizations --with-lto``.
251+
This sets the default make targets up to enable Profile Guided Optimization (PGO)
252+
and may be used to auto-enable Link Time Optimization (LTO) on some platforms.
253+
See :option:`python:--enable-optimizations` and :option:`python:--with-lto`
254+
to learn more about these options.
255+
256+
.. code:: console
257+
258+
$ ./configure --enable-optimizations --with-lto
259+
260+
240261
.. _windows-compiling:
241262

242263
Windows

0 commit comments

Comments
 (0)