[Patches] [ python-Patches-426072 ] special case "O" in PyArg_ParseTuple()

noreply@sourceforge.net noreply@sourceforge.net
Fri, 25 May 2001 23:58:41 -0700


Patches item #426072, was updated on 2001-05-21 14:29
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=426072&group_id=5470

Category: core (C code)
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Jeremy Hylton (jhylton)
>Assigned to: Jeremy Hylton (jhylton)
>Summary: special case "O" in PyArg_ParseTuple()

Initial Comment:
The most common argument passed to PyArg_ParseTuple() 
is one or more Os. Special-case Os to make this go a
bit faster.

Also eliminate the convertsimple(), convertsimple1()
two-step, since it's adding an extra function call to
all cases to handle the error cases.  Instead, call the
extra function only when an error occurs.

Note that the indentation in this patch is a bit messy.

The speedup is modest.  On the parsetuple-intensive
benchmarks like pybench's BuiltinFunctionCalls, this
patch reduces the cost of PyArg_ParseTuple() by almost
40%.


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

>Comment By: Tim Peters (tim_one)
Date: 2001-05-25 23:58

Message:
Logged In: YES 
user_id=31435

Since there are other schemes under active discussion right 
now, how about applying the large pieces of this patch that 
make the current code saner?  Like avoiding the two-step, 
and transforming masses of if/else_if/else_if/ ... into 
switch stmts.  That's Good Stuff regardless -- and make the 
rest of the patch small enough to understand what's 
*really* changing <wink>.

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

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