[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Py C/API - Using METH_O vs METH_VARARGS



Campbell Barton wrote:
On Tue, Dec 23, 2008 at 9:53 AM, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
[snip]

I checked the online Python documents and METH_O is present in Python 2.2.
That is the earliest Python version with current Pygame development, on the
Nokia S60. I personally was going to do a timing test to see if METH_O made
a significant performance difference. If not then it is not worth the bother
making the changes for ascetic reasons alone.

--
Lenard Lindstrom
<len-l@xxxxxxxxx>



From a loop of 10,000,000, heres my timings

pass 1.85659885406
METH_NOARGS 3.24079704285
METH_O 3.66321516037
METH_VARARGS 6.09881997108
METH_KEYWORDS 6.037307024
METH_KEYWORDS (as keyword) 10.9263861179

------- Python Script, (used blender module for testing)

[snip code]

Okay, I am in agreement. It may not make much difference in computationally heavy functions, but it can't hurt to make the switch to METH_O.

--
Lenard Lindstrom
<len-l@xxxxxxxxx>