<div dir="ltr">Thanks for these patch : I've applied all and commited them.<div><br></div><div>I must admit I am yet far from good practises.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/1 James Cameron <span dir="ltr"><<a href="mailto:quozl@laptop.org" target="_blank">quozl@laptop.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, Oct 01, 2013 at 10:34:54AM +0200, laurent bernabe wrote:<br>
> But I don't think I can avoid repainting all screen at each frame,<br>
> as the balls move, so according to me, the performance gained this<br>
> way, in the case of my application, won't be that high. Maybe, I am<br>
> wrong.<br>
<br>
Yes, you're wrong.  ;-)<br>
<br>
The performance gain is of the order of six times.  Using top in 20<br>
second sample period, the CPU usage dropped from 30% to 5%, just for<br>
the game process.  There was a similar drop for the X process, which<br>
is the display handler.<br>
<br>
Please find attached five patches, which you can apply in order.<br>
<br>
The patches change the drawing functions to return sequences<br>
containing rectangles, which are then used by Pygame to update only<br>
the parts of the screen that need to be repainted.<br>
<br>
If the patches do not apply (git am), then perhaps you have made other<br>
changes, and I can rebase them.  Push your changes and let me know.<br>
<br>
These changes will make the activity less energy intensive.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
James Cameron<br>
<a href="http://quozl.linux.org.au/" target="_blank">http://quozl.linux.org.au/</a><br>
</font></span></blockquote></div><br></div>