[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Python and Speed



hi,

Each release of python gets a little faster... but not massively.  It
really needs to get 10-20x faster - but generally only gets up to 1.2x
faster with each release.

There's also work on things like pypy - which might one day be quite
fast.  I think pypy will drive Cpython to get faster through
competition - and ideas.  An example of this recently happening is the
method cache (which I think the idea actually came from tinypy...).
The method cache was shown to work well with pypy, and then Cpython
added the idea.  If pypy becomes faster, then I think the Cpython
people will try harder to make Cpython faster too.

However mainly it's good to try and make highly reusable, and fast
basic building blocks - and then glue them together with python.

For example, if you see something that most pygame games would get
faster with, then add it to pygame.  Or to SDL, or to python.  If the
drawing part of the game takes 10% less time, that leaves 10% of time
for game code.  As examples in the last pygame release - The
pygame.sprite.LayeredDirty sprite work, the threading work, and
modifications to some functions to allow reusing surfaces(eg
transform.scale) in the last pygame should make a lot of pygame games
quicker.  For SDL the blitters have been optimized with mmx, and
altivec assembly - and the upcoming SDL 1.3 can optionally use opengl,
and direct3d hardware acceleration.

Also the included PixelArray should allow you to do a lot of things
quicker - and you can rely on it to be included with pygame(unlike
numeric/numpy).  We hope to have fast vector, and matrix types
included at some point in the future too.


If you've got any ideas for reusable speed ups - we'll gladly consider
them in pygame.


cheers,




On Thu, Apr 17, 2008 at 11:36 AM, Ian Mallett <geometrian@xxxxxxxxx> wrote:
> Recently, I've been having issues in all fortes of my programming experience
> where Python is no longer fast enough to fill the need adaquately.  I really
> love Python and its syntax (or lack of), and all the nice modules (such as
> PyGame) made for it.  Are there any plans to improve Python's speed to at
> least the level of C languages?  I feel like Python is living down to its
> namesake's pace...
>  Ian
>