On Mon, Sep 27, 2021 at 10:40 AM Steve Dower <steve.dower@python.org> wrote:
On 9/27/2021 5:51 PM, Eric Snow wrote:
> Possible solutions:
> 1. always default to "on" (the annoyance for contributors isn't big enough?)
> 2. default to "on" if it's a PGO build (and "off" otherwise)

Just to air my concerns regarding option 2 (which I've already spoken to
Eric about): I feel this option is completely orthogonal to whether PGO
is used or not, and ought to be discoverable independently.

Essentially, it should be its own configure-time option, and should be
included somewhere in sysconfig.get_config_var(...).

If we went with #2, there's no reliable way to detect whether
profile-guided optimisations were used on all CPython builds, which
means there'd be no reliable way to detect whether frozen modules are
going to be enabled by default or not. Adding a separate option handles
this case.

(My overall preference is for #3, FWIW)

When I proposed #2, I used "PGO" as a proxy for "best optimization mode". On UNIX, this is `./configure --enable-optimizations`, which doesn't mention PGO -- IIUC it turns on PGO and LTO, if they're available.

So my *actual* proposal (call it #2') is to use a separate compile-time flag, which is set by `./configure --enable-optimizations` regardless of whether PGO/LTO are possible, and which on Windows can be set by `PCbuild\build.bat --pgo` (we could add another flag to disable it, but who'd want to?).

--Guido van Rossum (python.org/~guido)