Performance in embeded / extended python

Emmanuel Astier emmanuel.astier at winwise.fr
Wed Jul 4 10:20:15 EDT 2001


Hi, 


I embedded and extended python for a game, and I was REALLY
disappointed by the performances I get...

Every frame of my game ( should be 60 time by second ) I call my
Python logical part from my C game with :

PyObject_CallFunction( LogicalEntryPoint, NULL );

Logical Entry Point being a PyObject* pointing on the name of the
function.

My function do only :

    for i in range ( 0, NbTestSprites - 1 ):
        ListOfSprites[i].setPos( 100, 100 )

ie it sets the pos of 200 sprites.
ListOfSprites is a tuple of 200 sprites, sprites is a extension class,
and setPos one of its method.

I'm using Swig to extend Python with my C functions ( I Tried Boost
too, but there is even more overhead... )

This is _REALLY_ slow ( i run at around 1 Frame / second on a P733 ).

200 sprites is not so much...

Have someone a clue of something I could have done wrong ?

Can't extended python be faster ?

Any help appreciated, 

thanks, 

Emmanuel






More information about the Python-list mailing list