[Mirra] performance tests

enrike enrike at ixi-audio.net
Sun May 20 21:39:29 CEST 2007


hi

After the posts from last week i have been doing some performance tests. 
I set the fps to 3000 and then run few different combinations. For 
example I run an empty mirra application and I got few hundreds of fps. 
Then I created lines and the more lines the slower it get, as expected.

I did some tests with snow.py as we talked about this file during the 
week, I get around 11-12 fps on my P4 running Ubuntu, I havent tried on 
Windows, I guess it runs a bit faster because the Linux drivers for my 
ATI are crap.

Then i modify the snow.py to overwrite the render function on the Flake 
class. Having the same general function as in the Engine but directly in 
the class allowed to get up to 15-16 fps. Later I decided to adapt the 
function to the actual Flakes, they have all same color, no stroke, no 
style and have four vertexes. So I can get rid of few if statements 
here. This allowed me to go up to 17-18 fps. I could get up to 19-20 by 
removing the for that loops the vertex list replacing it by four 
glVertex2i() calls, one for each vertex

So the bigger improvement was moving the drawing functions to the 
classes themselves, this saves one function call per object rendered per 
frame. This makes sense as calling functions is pretty expensive in 
Python compared to other tasks. Of course this would be only noticeable 
when drawing many objects like in the snow.py *Note that I set the 
number of flakes to 100, before it was 150.*

Please find attaches two versions of snow.py in case you want to test 
it. The first overwrites the render function with a general function 
similar to the one in the engine. The seconds adapts the render function 
to the Flakes characteristics removing few ifs.

At this point I might do an attempt to transfer the drawing functions 
from the Engine to the classes in the graphics module, I dont like it 
very much this idea programming wise because it means spreading the 
OpenGL code over several classes. But it might be worth in terms of 
performance.

enrike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: snow_adapted.py
Type: text/x-python
Size: 2792 bytes
Desc: not available
Url : http://lists.goto10.org/pipermail/mirra/attachments/20070520/c7c96672/snow_adapted.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: snow_general.py
Type: text/x-python
Size: 3076 bytes
Desc: not available
Url : http://lists.goto10.org/pipermail/mirra/attachments/20070520/c7c96672/snow_general.py


More information about the Mirra mailing list