On Jan 31, 2011, at 7:45 AM, Antoine Pitrou wrote:

> On Mon, 31 Jan 2011 13:28:39 +0100
> "Jurjen N.E. Bos" <jurjen....@hetnet.nl> wrote:
>> I just did it: my first python source code hack.
>> I replaced the NEXTARG and PEEKARG macros in ceval.c using a cast to  
>> short pointer, and lo and behold, a crude measurement indicates one  
>> to two percent speed increase.
>> That isn't much, but it is virtually for free!
>> 
>> Here are the macro's I used:
>> #define NEXTARG() (next_instr +=2, *(short*)&next_instr[-2])
>> #define PEEKARG() (*(short*)&next_instr[1])
> 
> Some architectures forbid unaligned access, so this can't be used as-is.

It could perhaps be #ifdef'd in on x86/x86-64, though, which is by far the most 
common architecture to run python on.

James
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to