[Mirra] Mirra runs veeeeeeeery slowly

enrike enrike at ixi-audio.net
Wed May 16 11:56:13 CEST 2007


hi luis

mirra does few calculations in some cases (when drawing many
of rects or polygons). This is why I think it slows down compared to a
basic pygame or pyopengl example. There is quite a lot of code on top of
pyopengl.

About profiling ... I have been trying to optimise quite a lot the code
that runs every frame but at the moment it is difficult to find out
exactly which bits are critical (if any! maybe is just the whole system).

This is the way to profile functions, using the profile module like this

def speed() :
     for i in xrange(150000):
	i+1
	i/2

import profile
profile.run('speed()')

this will tell you how much memory and cpu took each line and the whole
function. So you can test different ways to write the function to find
which one is more efficient.

But you might know this already, it would be handy to have a system that
allows to run applications like this so that a mirra example would run
under supervision from the profiler. But I dont know if there is such a
system.

We are also considering to rewrite certain areas with C, C++ to improve
speed. Also some drawing functions could be possibly rewritten in python
again to minimise the amount of code in each function. I have actually
done that on the svn version, but this is pretty unstable yet.

If you find any points that could be improved please let us know, we
would be *reeaaally* happy to hear about this.

One technique I am using to optimise the apps i develop with mirra is
once i have the app properly defined i overwrite the render method of
object to expose the OpenGL directly there. The rendering functions in
the engine are quite general (maybe too general actually) and have few
if statements, one can always write an specific render method for a
class that skips the ifs. Of course you need to be familiar with OpenGL
in this case. Check example 05complexshapesopenGL.py see how the Circle
render method is totally overwritten to expose the OpenGL, this is
cheaper because it saves few ifs and a function call.

cheers

enrike


dropmeaword at yahoo.com(e)k dio:
> Hello all,
> 
> After some initial struggle installing Mirra and getting it to work properly I fiddled around a little with the examples, to get familiar with it. But they run very slowly on my system. I run Python 2.4.1, pyOpengl 3.0.0a6, pygame 1.7.1, ctypes, wxPython 2.8.3.0-unicode. Psyco is installed. The version of Mirra that I run 0.3.1 uses wxPython for window management. I have increased the framerate of the samples from 15 to 24fps but it doesn't affect performance, as the current framerate doesn't even reach 10fps.
> 
> I can run pygame sample programs at more than 400fps, so it's obviously not a problem of the machine not performing well. I don't really know how to profile python programs, so I don't know where to begin to find out what the problem might be. Do you know any method of profiling python programs so I can see where the stalling occurs? or have any clue about where the bottleneck might be?
> 
> Any ideas are welcome. TIA.
> 
> Cheers,
> Luis.
> 
__
> Mirra mailing list
> Mirra at goto10.org
> http://lists.goto10.org/cgi-bin/mailman/listinfo/mirra
> 





More information about the Mirra mailing list