Performance in embeded / extended python
cliechti at nospam.mails.ch
Wed Jul 4 17:02:42 EDT 2001
[posted and mailed]
emmanuel.astier at winwise.fr (Emmanuel Astier) wrote
> Every frame of my game ( should be 60 time by second ) I call my
are you sure you need to call this fu 60 times a second? the eye can't see
more than 16 to 20 frames per second. flickering (refresh rate of display)
can be seen for higher rates too but no detail or movements in the picture
are catched by the eye.
i would call python only every second frame.
of course this wasn't your question - just a thought from my side...
some real optimisations:
don't call "range" every time - use a precalculated list with the numbers
or beter iterate as follows:
for sprite in ListOfSprites:
sprite.setPos( 100, 100 )
should save a bit time (no list indexing, no generation of a throw-away
list of indexes).
or even better: don't use "for" use "map" instead:
and you might be interested in the folowing URL:
threre are some "Python Performance Tips" (including the one above)
email = 'cliechti at nospam.mails.ch'
More information about the Python-list