[Lazarus] Sprite example

Luiz Americo Pereira Camara luizmed at oi.com.br
Tue May 13 19:06:12 CEST 2008


Graeme Geldenhuys wrote:
> OK, so now the Sprite example runs smoothly under GTK1 as well. Thanks 
> Mattias.  :-)
>
> One more problem: CPU usage!
>
> Under my Linux system (Intel P4 2.40GHz with 1Gig memory and Ubuntu 7.10 
> distro), xload shows 100% cpu load. Top shows 8.7-9.3% which is damn 
> high. I don't move or resize the window and don't touch the mouse while 
> the demo is running.
>
> Running the Sprite demo ported to fpGUI (on the same system as above), 
> xload and top shows the sprite demo at 0.0-0.3% cpu usage, like most 
> (almost idle) applications. Plus, in this demo the timer is set at to 
> default of 50ms, whereas the LCL sprite demo timer is set at 100ms.
>   

I tested the fpGui example and found that it is using low cpu because is 
not scaling the image to fit into the window like LCL does. Notice that, 
in the LCL, if the window is of the size or smaller than the background 
image the cpu usage is very low (0%) even if using StretchDraw function.

On the other hand after i changed the fpgui example to use 
Canvas.StretchDraw function the cpu usage sky rocketed up to 50% in my 
Core 2 Duo under win32 XP even if the window is of the size or smaller 
than the background image.

As a side note the sprite image is rounded by a clFuchsia line.

All in all, congratulations by the fpGui. I'll be testing it for the 
next few days.

Luiz



More information about the Lazarus mailing list