[New-bugs-announce] [issue11087] Speeding up the interpreter with a few lines of code

Jurjen N.E. Bos report at bugs.python.org
Tue Feb 1 08:57:33 CET 2011


New submission from Jurjen N.E. Bos <jneb at users.sourceforge.net>:

I found a very simple way to improve the speed of CPython a few percent on the most common platforms (i.e. x86), at the cost of only a few lines of code in ceval.c
The only problem is that I don't have any experience in patch submission.

Here are the suggested new lines (also see submitted file):

#define NEXTARG() (next_instr +=2, *(unsigned short*)&next_instr[-2])
#define PEEKARG() (*(unsigned short*)&next_instr[1])

of course this code only works on little-endian processors that allow nonaligned shorts; a change to configure might be needed (*shiver*).

Hope you like it.

----------
components: Interpreter Core
files: speedpatch.c
messages: 127686
nosy: jneb
priority: normal
severity: normal
status: open
title: Speeding up the interpreter with a few lines of code
type: performance
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file20638/speedpatch.c

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11087>
_______________________________________


More information about the New-bugs-announce mailing list