[Python-ideas] Disabling optimizations
Stefan Behnel
stefan_ml at behnel.de
Fri May 23 07:28:32 CEST 2014
Stefan Behnel, 23.05.2014 07:02:
> 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.
Stefan Krah already proposed -Os (optimise for space) for the cases where
you want to reduce the size of the byte code file, e.g. by removing doc
strings. That could become the next .pyo file. Although it's unclear to me
why you would do that, instead of just compressing them.
Stefan
More information about the Python-ideas
mailing list