[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

psyco, pyrex was Re: [pygame] Allegro and SCAM



 --- Syver Enstad <syver-en@online.no> wrote: >
Leonardo Santagada <retype@terra.com.br> writes:
> > 
> > Also is psyco really a good thing for using in
> pygame?
> 
> I don't know yet. It certainly was a good thing for
> the flaming sparks
> demo that I tried it on. Be aware that I got much
> better results by
> using the selectively binding code to be compiled
> with psyco than just
> doing psyco.jit(). 
> 

I've tried psyco for a few real things, and it mostly
doesn't speed code up.  It doesn't do floats, and
anything where you are using data structures is not
any faster.  Using bind selectively sure is better
than jit.  I read on the psyco mailing list that the
author is looking for someone to use the quick
profiler in python2.2 for selectively compiling the
slowest functions.

It does speed up integer code though.  But mostly I'm
not doing integer only stuff.

I've had more luck with pyrex.  Which allows you to
mix c and python for writing extentions.

cdef c_bla():
    cdef int i
    cdef float x
    i = 0
    while i < 10000:
        i = i + 1
        if i < 1000:
            x = x + 1
    return x

def bla():
    return c_bla()

Although you could do the same with psyco as fast( or
close enough ),  you can do more complex things with
pyrex.  Actually you couldn't do this quickly with
psyco as it can't do floats( but it's a contrived
example anyway ).

Only downside I've come accross with pyrex so far is
that it only works with python2.2.  ie no 2.1 :(

Any other neat programs/modules which people are using
to speed their code up (aside from swig)?



__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org