[New-bugs-announce] [issue26647] Wordcode

Demur Rumed report at bugs.python.org
Sat Mar 26 19:27:48 EDT 2016

New submission from Demur Rumed:

Originally started @ https://github.com/abarnert/cpython/tree/wpy

This patch is based off of https://github.com/serprex/cpython/tree/wpy

It omits importlib.h & importlib_external.h as those are generated

It omits https://github.com/serprex/cpython/blob/wpy/Python/wordcode.md

I got around to benchmarking against building on master rather than using my repo's packaged version, it's currently a 1% speed improvement (every bit counts). I'm testing on an Intel Atom 330 with Linux.  Besides the minor perf increase, it generates smaller bytecode & is simpler (peephole now handles EXTENDED_ARG since it isn't too hard to track & while loops become for loops in dis)

Previous discussion: https://mail.python.org/pipermail/python-dev/2016-February/143357.html

pdb works without changes. coverage.py doesn't seem to rely on anything this changes

I modified byteplay to target this change mostly over the course of half an hour before work: https://github.com/serprex/byteplay/blob/master/wbyteplay.py

I'd be interested to hear if this encoding simplifies things for FAT python & the recent work to cache attribute/global lookup

Remaining code issues: peepholer could allocate half the space as it does now for basic block tracking, compile.c & peephole.c repeat themselves on computing instruction size given an argument & how to spit out an instruction given an argument

Breaking change in dis: I've removed HAVE_ARGUMENT. This is to help code fail fast. It could be replaced with IGNORES_ARGUMENT or, as abarnert suggested, a range(90,256) named after the other hasXXXs 'hasarg'

components: Interpreter Core
files: wpy.patch
keywords: patch
messages: 262501
nosy: Demur Rumed
priority: normal
severity: normal
status: open
title: Wordcode
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file42300/wpy.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list