[Patches] [ python-Patches-1408710 ] use computed goto's in ceval loop

SourceForge.net noreply at sourceforge.net
Wed Jan 18 04:21:12 CET 2006


Patches item #1408710, was opened at 2006-01-18 03:21
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1408710&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Simon David Burton (simonb1)
Assigned to: Nobody/Anonymous (nobody)
Summary: use computed goto's in ceval loop

Initial Comment:

An experiment where the big switch in ceval.c
is replaced with a computed goto construct.
Uses #define's to make it optional.
Inspired by Mono's MINT interpreter code,
and Neil Norwitz's attempt to use a function
pointer table:

http://sourceforge.net/tracker/index.php?func=detail&aid=693638&group_id=5470&atid=305470

Result: about 1% slower on the pystone benchmark.

Also it seems to have broken the interpreter;
at least one test fails (test_StringIO).

Not sure if the other switch speedup
hacks (eg. PREDICT(op)) conflict 
at all with this patch (ie. make it
slower than it could be).

Mono actually uses a much larger opcode
set, with 2-byte opcodes, that includes
type info in each opcode. This means that
the actual case statements are much faster.
My initial thought about using computed goto's
(January 2003) was that the python opcode cases
were much fatter than mono's (often involving
a function call) and that the overhead of
branching on the opcode would be insignificant.
It seems that this is true indeed.

Patch is for python revision 42025.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1408710&group_id=5470


More information about the Patches mailing list