[Patches] [ python-Patches-670367 ] Micro-optimizations for ceval.c

SourceForge.net noreply@sourceforge.net
Sat, 18 Jan 2003 14:52:33 -0800


Patches item #670367, was opened at 2003-01-18 20:07
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=670367&group_id=5470

Category: None
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Nobody/Anonymous (nobody)
Summary: Micro-optimizations for ceval.c

Initial Comment:
Make the code slightly shorter, faster, and easier to 
read.

* Eliminate unused DUP_TOPX code for x==1.  
compile.c always generates DUP_TOP instead.

* Since only two cases remain for DUP_TOPX, replace 
the switch-case with if-elseif.

* The in-lined integer compare does a CheckExact on 
both arguments.  Since the second is a little more 
likely to fail, test it first.

* The switch-case for IS/IS_NOT and IN/NOT_IN can 
separate the regular and inverted cases with no 
additional work.  For all four paths, saves a test and 
jump.

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

>Comment By: Martin v. Löwis (loewis)
Date: 2003-01-18 23:52

Message:
Logged In: YES 
user_id=21627

What kind of speed-up have you observed for what test case?

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

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