embedded python: efficency query

Farshid Lashkari lashkariNO at SPAMworldviz.com
Wed Nov 10 14:06:33 EST 2004


Hi,

PyObject_CallFunction will parse the arguments and create a tuple from it,
which then calls PyObject_Call. You can try creating this tuple ahead of
time to avoid allocating it for every call. This might help a little.

-Farshid

<benevilent at optusnet.com.au> wrote in message
news:mailman.6203.1100074409.5135.python-list at python.org...
> Hey,
>
> I am embedding Python in an application, and have an efficency concern
> about this. There is a Python method which is called from the main
> application (written in C) many times per second (I am using the
> PyObject_Call function). Unfortunately this seems to be a bottleneck, as
> when the performance is compared to another language frontend of this
> application, when there involves many transitions from the core
> application to the language frontend, the other frontend outperforms
> Python. When there are few transitions from the core application to the
> language frontend (there still may be many transitions from the language
> frontend to the core application) Python outperforms the other language
> frontend by a healthy margin.
>
> I will try to profile the application with both frontends to find out
> more details, but I would be intereseted to know if there are any
> efficency improvements that can be used to speedup the Python frontend
> in the case described above.
>
> Thanks,
> Laurie
>
>





More information about the Python-list mailing list