[Pyrex] Faster calls to objects/functions

Stefan Behnel behnel_ml at gkec.informatik.tu-darmstadt.de
Mon Apr 17 22:25:51 CEST 2006


Hi,

I made the following change in Pyrex/Compiler/ExprNodes.py (~ line 1200,
generate_result_code), which makes Pyrex generate more efficient code for
object calls.

-                "%s = PyObject_CallObject(%s, %s); if (!%s) %s" % (
+                "%s = PyObject_Call(%s, %s, 0); if (!%s) %s" % (


Internally, PyObject_CallObject goes through a number of checks and default
value generation steps before calling PyObject_Call. The direct call with a
0-value as third (keyword) argument is therefore substantially more efficient.

Stefan



More information about the Pyrex mailing list