[Python-ideas] More compact bytecode

Chris Angelico rosuav at gmail.com
Thu Feb 4 21:57:57 EST 2016


On Fri, Feb 5, 2016 at 9:22 AM, Andrew Barnert via Python-ideas
<python-ideas at python.org> wrote:
> You may be able to import some of the "spirit" of the first one into the second, but I'm not sure it's worth it. One of the minor problems with wordcode is that args in range [256, 65536) now take 4 bytes instead of 3. If you cram a few bits into the opcode byte, you can push the range farther back. I'm guessing it's pretty rare to do LOAD_CONST 256, but giving, say, 5 bits to JUMP_ABSOLUTE, and 2 bits to each of the various relative jumps, would cut down the need for EXTENDED_ARGS dramatically.
>

At the cost of complexity, possibly including less readable code. This
change can always be done later, if and only if it proves to make
enough difference in performance.

ChrisA


More information about the Python-ideas mailing list