]> granicus.if.org Git - python/commit
Introduced macros for a simple opcode prediction protocol.
authorRaymond Hettinger <python@rcn.com>
Sun, 16 Mar 2003 03:11:04 +0000 (03:11 +0000)
committerRaymond Hettinger <python@rcn.com>
Sun, 16 Mar 2003 03:11:04 +0000 (03:11 +0000)
commitf606f87b31186e7614cbae8e5b8ef05700f6267e
tree66c3ae468afb4b6ae4684a904d01d9a332a825b8
parent0070f007f4b30a31e7f59ec798ae6f555bcb0c08
Introduced macros for a simple opcode prediction protocol.

Applied to common cases:
    COMPARE_OP is often followed by a JUMP_IF.
    JUMP_IF is usually followed by POP_TOP.

Shows improved timings on PyStone, PyBench, and specific tests
using timeit.py:
    python timeit.py -s "x=1" "if x==1: pass"
    python timeit.py -s "x=1" "if x==2: pass"
    python timeit.py -s "x=1" "if x: pass"
    python timeit.py -s "x=100" "while x!=1: x-=1"

Potential future candidates:
    GET_ITER predicts FOR_ITER
    FOR_ITER predicts STORE_FAST or UNPACK_SEQUENCE

Also, applied missing goto fast_next_opcode to DUP_TOPX.
Python/ceval.c