bpo-24318: Rewrite the README PGO section. (GH-6863) · python/cpython@447fdd1 (original) (raw)

`@@ -93,25 +93,26 @@ Profile Guided Optimization

`

93

93

`^^^^^^^^^^^^^^^^^^^^^^^^^^^

`

94

94

``

95

95

`PGO takes advantage of recent versions of the GCC or Clang compilers. If used,

`

96

``


either via ``configure --enable-optimizations`` above or by manually running

97

``


``make profile-opt`` regardless of configure flags it will do several steps.

98

``

-

99

``

`-

First, the entire Python directory is cleaned of temporary files that may have

`

100

``

`-

resulted in a previous compilation.

`

101

``

-

102

``

`-

Then, an instrumented version of the interpreter is built, using suitable

`

103

``

`-

compiler flags for each flavour. Note that this is just an intermediary step.

`

104

``

`-

The binary resulting from this step is not good for real life workloads as

`

105

``

`-

it has profiling instructions embedded inside.

`

106

``

-

107

``

`-

After this instrumented version of the interpreter is built, the Makefile will

`

108

``

`-

automatically run a training workload. This is necessary in order to profile

`

109

``

`-

the interpreter execution. Note also that any output, both stdout and stderr,

`

110

``

`-

that may appear at this step is suppressed.

`

111

``

-

112

``

`-

Finally, the last step is to rebuild the interpreter, using the information

`

113

``

`-

collected in the previous one. The end result will be a Python binary that is

`

114

``

`-

optimized and suitable for distribution or production installation.

`

``

96


either via ``configure --enable-optimizations`` or by manually running

``

97


``make profile-opt`` regardless of configure flags, the optimized build

``

98

`+

process will perform the following steps:

`

``

99

+

``

100

`+

The entire Python directory is cleaned of temporary files that may have

`

``

101

`+

resulted from a previous compilation.

`

``

102

+

``

103

`+

An instrumented version of the interpreter is built, using suitable compiler

`

``

104

`+

flags for each flavour. Note that this is just an intermediary step. The

`

``

105

`+

binary resulting from this step is not good for real life workloads as it has

`

``

106

`+

profiling instructions embedded inside.

`

``

107

+

``

108

`+

After the instrumented interpreter is built, the Makefile will run a training

`

``

109

`+

workload. This is necessary in order to profile the interpreter execution.

`

``

110

`+

Note also that any output, both stdout and stderr, that may appear at this step

`

``

111

`+

is suppressed.

`

``

112

+

``

113

`+

The final step is to build the actual interpreter, using the information

`

``

114

`+

collected from the instrumented one. The end result will be a Python binary

`

``

115

`+

that is optimized; suitable for distribution or production installation.

`

115

116

``

116

117

``

117

118

`Link Time Optimization

`