[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Pygame to C/C++?
On Mar 1, 2004, at 12:38 AM, Derek Simkowiak wrote:
I'm thinking of rewriting some of my Python/Pygame code into C (or
C++?) with SDL to get a speed improvement.
[...]
Good luck on this. There hasn't been a lot of experimentation on this
sort of thing. I'm sure other besides myself are interested in seeing
what kind of results you will get.
I've done this. It worked f'ing sweet for me.
Tips:
1. Never trust your instinct on where to optimize -- it's mostly
wrong. Use the Python profiler to find what to rewrite.
2. Use SWIG.
Note that moving to SDL will only speed things up if the slow part is
in Python. Moving to C does not reduce the number of calculations
that must be done in a game -- it just drops all the overhead that
comes with Python bytecode.
From my experience, I would say use Pyrex or Boost (if C++).. not SWIG.
I totally agree with your other points, though.
-bob