This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Better documentaiton of profile-opt (and release builds in general?)
Type: Stage: resolved
Components: Documentation Versions: Python 3.4, Python 3.5, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, gregory.p.smith, jwagner, miss-islington, r.david.murray, skip.montanaro
Priority: normal Keywords: easy, patch

Created on 2015-05-28 16:34 by skip.montanaro, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
README.diff skip.montanaro, 2015-05-28 16:34 review
Pull Requests
URL Status Linked Edit
PR 6538 merged gregory.p.smith, 2018-04-19 15:44
PR 6539 merged miss-islington, 2018-04-19 16:14
PR 6540 merged miss-islington, 2018-04-19 16:15
PR 6863 merged gregory.p.smith, 2018-05-15 15:36
PR 6909 merged miss-islington, 2018-05-16 15:35
Messages (9)
msg244317 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2015-05-28 16:34
In a discussion on python-ideas about some computed goto stuff, Greg Smith brought up compilation with "profile-opt", which I'd never heard of. I asked Greg about it and he enlightened me. Looking around, I saw no mention of this make target except in the Makefile itself, and a small what's new note for Python 2.6. I was only looking on the 2.7 branch, but aside from a bug fix mention in Misc/NEWS for Python 3.4, it doesn't seem to feature more prominently there.

It would seem to be stable. Should it perhaps be the default when available (presuming the proper configure tests can be written)? Alternatively, it could be featured more prominently in the build instructions. I've attached a simple patch to README for that.
msg244327 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2015-05-28 17:42
The Makefile's default "make all" target is meant for developers and iterative development.

make profile-opt is not.

If anything, this issue should document it somewhere if we even have docs on how to make "release" builds of something.  Realistically Debian already uses profile-opt for its binary builds.  I _believe_ the rpm based distros do as well (but I haven't checked, someone else can confirm).  Anyone else not doing so, please look at what debian does:

make profile-opt PROFILE_TASK="..."

where ... is given a test exclusion list of some of the longer running more annoying ones.

Not using a profile-opt builds in production is costing you ~10-40% in CPU performance.  This advice applies to all programs, not only python. :)
msg244328 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2015-05-28 17:42
Also FWIW, I setup a buildbot earlier this year building in profile-opt mode.
msg244332 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-05-28 18:01
Agreed with Greg, this should not be the default.  Changing title and component to reflect that better documentation is the goal here.
msg244337 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2015-05-28 18:43
Thanks. The doc change occurred to me while I was composing my ticket. It wasn't obvious at that time that profile-opt shouldn't be the default (though I was carrying on an email conversation with Greg at about the same time).
msg315484 - (view) Author: Joachim Wagner (jwagner) Date: 2018-04-19 10:13
The readme in 3.6.5 has a section on PGO but the sentence "If ran,
``make profile-opt`` will do several steps." can be misunderstood that one has to run this command instead of "make" after "configure --enable-optimizations". Furthermore, a 2015 post suggests that most Linux distributions use a different workload than the one provided for much better results. The readme should talk about this, either clarifying that this issue has been resolved or making recommendations for the workload. (I understand that licence incompatibilities or the size of the workload may be reasons for not including the recommended workload in the source distribution.)
msg315490 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2018-04-19 15:47
FYI - The test suite minus some of the crazier tests (multiprocessing) that the makefile uses today is the recommended workload and is effectively what linux distros I've looked at use.

It is a myth that the specific application workload matters a great deal for building a Python PGO interpreter.  The layer of indirection provided by an interpreter makes it easier.  All you really need is code that exercises the major important C speed paths.  The eval loop, unicode internals, long bignum internals, marshal, re, pickle, json, xml, and cdecimal are all well exercised by running the test suite.

A specific Python application's actual logic is not going to exercise the internals of those in a meaningfully different manner.

Performance experiments bear this out.
msg316820 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2018-05-16 15:34
New changeset 93f9a8a5afb58b1d2e4f27bb46d3d4e0fa8c08f0 by Gregory P. Smith in branch 'master':
bpo-24318: Rewrite the README PGO section. (#6863)
msg316837 - (view) Author: miss-islington (miss-islington) Date: 2018-05-16 16:35
New changeset 447fdd178f1007294db38bf0392a0cf74a49d460 by Miss Islington (bot) in branch '3.7':
bpo-24318: Rewrite the README PGO section. (GH-6863)
Date User Action Args
2022-04-11 14:58:17adminsetgithub: 68506
2018-05-16 16:35:00miss-islingtonsetnosy: + miss-islington
messages: + msg316837
2018-05-16 15:38:17gregory.p.smithsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-05-16 15:35:57miss-islingtonsetpull_requests: + pull_request6577
2018-05-16 15:34:49gregory.p.smithsetmessages: + msg316820
2018-05-15 15:36:59gregory.p.smithsetpull_requests: + pull_request6537
2018-04-19 16:15:29miss-islingtonsetpull_requests: + pull_request6236
2018-04-19 16:14:10miss-islingtonsetpull_requests: + pull_request6235
2018-04-19 15:47:36gregory.p.smithsetmessages: + msg315490
2018-04-19 15:44:20gregory.p.smithsetstage: needs patch -> patch review
pull_requests: + pull_request6234
2018-04-19 10:13:59jwagnersetnosy: + jwagner
messages: + msg315484
2015-05-28 18:43:42skip.montanarosetmessages: + msg244337
2015-05-28 18:01:38r.david.murraysetassignee: docs@python

components: + Documentation, - Build
title: Make profile-opt the default Make target? -> Better documentaiton of profile-opt (and release builds in general?)
nosy: + r.david.murray, docs@python
versions: + Python 3.4, Python 3.5, - Python 3.6
messages: + msg244332
stage: needs patch
2015-05-28 17:42:44gregory.p.smithsetmessages: + msg244328
2015-05-28 17:42:00gregory.p.smithsetnosy: + gregory.p.smith
messages: + msg244327
2015-05-28 16:34:25skip.montanarocreate