embedded python: efficency query

B

benevilent

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
 
F

Farshid Lashkari

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top