[Python-ideas] Changes to the existing optimization levels
Diana Clarke
diana.joan.clarke at gmail.com
Thu Sep 28 18:28:40 EDT 2017
Yup. I referenced your pep a few times in a previous off-list email,
but I omitted that paragraph from this pass because I was using it to
bolster the previous "level 3" idea (which didn't fly).
"""
This simple approach to new optimization levels also appears to be
inline with the direction Victor Stinner is going in for PEP 511 -
"API for code transformers" [1]. More specifically, in the "Optimizer
tag" section [2] of that PEP Victor proposes adding a new -o OPTIM_TAG
command line option that defaults to "opt" for the existing
optimizations, but would also let you to swap in custom bytecode
transformers (like "fat" in his examples [3]). Assuming I understood
that correctly ;)
os.cpython-36.fat-0.pyc
os.cpython-36.fat-1.pyc
os.cpython-36.fat-2.pyc
[1] https://www.python.org/dev/peps/pep-0511/
[2] https://www.python.org/dev/peps/pep-0511/#optimizer-tag
[3] https://www.python.org/dev/peps/pep-0511/#examples
"""
Thanks for taking the time to respond (you too Antoine).
Cheers,
--diana
On Thu, Sep 28, 2017 at 4:09 PM, Victor Stinner
<victor.stinner at gmail.com> wrote:
>> 2) Added a new command line option N that allows you to specify
>> any number of individual optimization flags.
>>
>> For example:
>>
>> python -N nodebug -N noassert -N nodocstring
>
> You may want to look at my PEP 511 which proposes to add a new "-o"
> option to specify a list of optimizations:
> https://www.python.org/dev/peps/pep-0511/#changes
>
> The PEP proposes to add a new sys.implementation.optim_tag which is
> used to generated the .pyc filename.
>
> Victor
More information about the Python-ideas
mailing list