Re: [Python-Dev] MAKE_FUNCTION simplification

On Thu, Apr 14, 2016 at 8:27 PM, Guido van Rossum <guido@python.org> wrote:
Great analysis! What might stand in the way of adoption is concern for bytecode manipulation libraries that would have to be changed. What might encourage adoption would be a benchmark showing this saves a lot of time.
Personally I'm expecting it won't make much of a difference for real programs since almost always the cost of creating the function is dwarfed by the (total) cost of running it. But Python does create a lot of functions, and there's also lambdas.
This change alone is very unlikely to have a measurable performance impact. The intention is to clean up ceval.c/compile.c a bit, nothing more. If many other opcodes were somehow slimmed down in the similar fashion, then we might (or might not) see perf gains. For example, most slot dispatch opcodes can be compressed into a single opcode+slot index with inlined dispatch logic, instead of each one individually calling C API functions...
There's also talk of switching to wordcode, in a different thread. Maybe the idea would be easier to introduce there? (Bytecode libraries would have to change anyways, so the additional concern for this change would be minimal.)
Wordcode can benefit from this change, because it guarantees single-byte MAKE_FUNCTION oparg. I think that Python should make bytecode explicitly unstable and subject to change with any major release. The potential for a faster Python interpreter (or simple JIT) is huge; requiring bytecode compatibility will slow down any progress in this area.

On 4/14/2016 12:03 PM, Nikita Nemkin wrote:
I think that Python should make bytecode explicitly unstable and subject to change with any major release.
https://docs.python.org/3/library/dis.html#module-dis CPython implementation detail: Bytecode is an implementation detail of the CPython interpreter. No guarantees are made that bytecode will not be added, removed, or changed between versions of Python. Version = minor release, as opposed to maintenance release. -- Terry Jan Reedy

On Thu, Apr 14, 2016, at 12:56, Terry Reedy wrote:
https://docs.python.org/3/library/dis.html#module-dis CPython implementation detail: Bytecode is an implementation detail of the CPython interpreter. No guarantees are made that bytecode will not be added, removed, or changed between versions of Python.
Version = minor release, as opposed to maintenance release.
"between versions" is ambiguous. It could mean that there's no guarantee that there will be no changes from one version to the next, or it could mean, even more strongly, that there's no guarantee that there will be no changes in a maintenance release (which are, after all, released *between* minor releases)

On 04/14/2016 10:02 AM, Random832 wrote:
"between versions" is ambiguous. It could mean that there's no guarantee that there will be no changes from one version to the next, or it could mean, even more strongly, that there's no guarantee that there will be no changes in a maintenance release (which are, after all, released *between* minor releases)
I don't see us making a breaking change in a maintenance release except to fix something that was already broken. -- ~Ethan~
participants (4)
-
Ethan Furman
-
Nikita Nemkin
-
Random832
-
Terry Reedy