[Python-Dev] PEP 488: elimination of PYO files

Neil Girdhar mistersheik at gmail.com
Fri Mar 6 19:27:05 CET 2015


On Fri, Mar 6, 2015 at 1:11 PM, Brett Cannon <brett at python.org> wrote:

>
>
> On Fri, Mar 6, 2015 at 1:03 PM Mark Shannon <mark at hotpy.org> wrote:
>
>>
>> On 06/03/15 16:34, Brett Cannon wrote:
>> > Over on the import-sig I proposed eliminating the concept of .pyo files
>> > since they only signify that /some/ optimization took place, not
>> > /what/ optimizations took place. Everyone on the SIG was positive with
>> > the idea so I wrote a PEP, got positive feedback from the SIG again, and
>> > so now I present to you PEP 488 for discussion.
>> >
>> [snip]
>>
>> Historically -O and -OO have been the antithesis of optimisation, they
>> change the behaviour of the program with no noticeable effect on
>> performance.
>> If a change is to be made, why not just drop .pyo files and be done with
>> it?
>>
>
> I disagree with your premise that .pyo files don't have a noticeable
> effect on performance. If you don't use asserts a lot then there is no
> effect, but if you use them heavily or have them perform expensive
> calculations then there is an impact. And the dropping of docstrings does
> have an impact on memory usage when you use Python at scale.
>
> You're also assuming that we will never develop an AST optimizer that will
> go beyond what the peepholer can do based on raw bytecode, or something
> that involves a bit of calculation and thus something you wouldn't want to
> do at startup.
>

I don't want to speak for him, but you're going to get the best results
optimizing ASTs at runtime, which is what I thought he was suggesting.
Trying to optimize Python at compile time is setting your sights really
low.   You have so little information then.


>
>
>>
>> Any worthwhile optimisation needs to be done at runtime or involve much
>> more than tweaking bytecode.
>>
>
> I disagree again. If you do something like whole program analysis and want
> to use that to optimize something, you will surface that through bytecode
> and not editing the source. So while you are doing "much more than tweaking
> bytecode" externally to Python, you still have to surface to the
> interpreter through bytecode.
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/mistersheik%40gmail.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150306/b2d07dc6/attachment.html>


More information about the Python-Dev mailing list