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

Re: [pygame] Does anyone have a python implementation of A*?



John Eikenberry <jae@zhar.net>:
[..]
> > (And I don't think a Python implementation of Dijkstra's algorithm
> > would have to be _that_ much slower than a C implementation. I guess
> > it depends on what "Python weaknesses" you're able to eliminate :)
>  
> Switched from the for-loop over new nodes to list comprehensions. Got
> over a 100x speedup!

Heh... And if your program was 100x slower than C to begin with you're
now down to C speed? ;)

> What took just over a second before, now takes
> around .08 seconds. I had thought it would help, but I didn't think it
> would this much. Goes to show you're point a bit I think. :)

Perhaps... Although it does sound odd, since list comprehensions are
implemented in terms of Python for loops, as far as I know. Perhaps
the change involved something else that might have affected
performance?

--
Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org