embedded python: efficency query

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • benevilent@optusnet.com.au

    #1

    embedded python: efficency query

    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


  • Farshid Lashkari

    #2
    Re: embedded python: efficency query

    Hi,

    PyObject_CallFu nction 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@opt usnet.com.au> wrote in message
    news:mailman.62 03.1100074409.5 135.python-list@python.org ...[color=blue]
    > 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
    >
    >[/color]


    Comment

    Working...