[Python-ideas] Disabling optimizations
Ethan Furman
ethan at stoneleaf.us
Fri May 23 07:42:07 CEST 2014
On 05/22/2014 10:02 PM, Stefan Behnel wrote:
> Ned Batchelder, 23.05.2014 03:44:
>> I'm of the opinion that we don't need to segregate bytecode into different
>> files depending on the options used to create the bytecode. How often is
>> the same program run in the same place with different options at different
>> times? I'm happy to have optimized and non-optimized code both written to
>> .pyc files, and if you are fiddling with the options like that, you should
>> delete your pyc files when you change the options. If we come up with a
>> way to have the bytecode file-segregated, I'm OK with that too.
>>
>> I definitely don't like the alternative that says unoptimized code isn't
>> written to disk at all. If people want to solve the problem that way,
>> there is already a mechanism to avoid writing bytecode, you can use it with
>> the optimizer controls to achieve the effect you want.
>
> As I already proposed, we could get rid of .pyo files all together and only
> write unoptimised .pyc files, and then apply the optimisations at load time
> based on the current interpreter config. I think that would give us a good
> tradeoff between fast (precompiled) code loading and differing requirements
> on byte code optimisations.
-1
The whole point of saving the compiled version to disk is to load-and-go.
I have no problem with having the pyc contain the info on which optimizations it was compiled with, and if the current
options are different then it gets recompiled. As Ned said, "How often is the same program run in the same place with
different options at different times?"
--
~Ethan~
More information about the Python-ideas
mailing list