[Lazarus] Performance of GTK 2 and CE

Martin Schreiber fpmse at bluewin.ch
Tue Nov 11 14:09:08 CET 2008


On Monday 10 November 2008 21.44:12 Graeme Geldenhuys wrote:
> On Mon, Nov 10, 2008 at 7:39 PM, Mark Morgan Lloyd
>
> <markMLl.lazarus at telemetry.co.uk> wrote:
> > x86 800MHz laptop Debian "Lenny" 0.9.26/2.2.2
> >        local
> >                gtk       3.7
> >                gtk2     13.7
> >        remote
> >                gtk      10.0
> >                gtk2     60.4
>
> Wow, even local GTK2 is *way* slower than GTK1.  So I really wasn't
> imagining it when I switch Lazarus IDE to GTK2.
>
> I was curious to see what it does on my system. So I created a test
> based on what you said. I used GTK1, GTK2 and fpGUI toolkit. In all
> three tests all component where the exact same size and contained the
> exact same text.  Here are my results from the following code:
>
Some more competition:   ;-)

Suse 11 32bit, AMD Athlon XP3000+ 2.15GHz, ATI Radeon 9200SE

gtkperf:

GtkEntry - time:  0.08
GtkComboBox - time:  2.40
GtkComboBoxEntry - time:  2.07
GtkSpinButton - time:  0.40
GtkProgressBar - time:  0.36
GtkToggleButton - time:  0.72
GtkCheckButton - time:  0.64
GtkRadioButton - time:  0.73
GtkTextView - Add text - time:  0.90
GtkTextView - Scroll - time:  0.75
GtkDrawingArea - Lines - time:  0.47
GtkDrawingArea - Circles - time:  0.67
GtkDrawingArea - Text - time:  1.19
GtkDrawingArea - Pixbufs - time:  0.56
 ---
Total time: 11.95

Lazarus GTK1
Duration: 00:00.435
Duration: 00:00.462
Duration: 00:00.461
Duration: 00:00.464
Duration: 00:00.462
Duration: 00:00.469

Lazarus GTK2
Duration: 00:04.269
Duration: 00:04.264
Duration: 00:04.277
Duration: 00:04.280
Duration: 00:04.290
Duration: 00:04.295

MSEgui button with caption, compiled with -B -O3
Duration: 00:00.214
Duration: 00:00.214
Duration: 00:00.213
Duration: 00:00.212
Duration: 00:00.215
Duration: 00:00.213

Lazarus code:
var
  i: integer;
  s: TDateTime;
  e: TDateTime;
begin
  s := Now;
  for i := 1 to 1000 do
  begin
    if (i mod 2) = 0 then
      Panel1.Color := clRed
    else
     Panel1.Color := clBlue;
    Application.ProcessMessages;
  end;
  e := Now - s;
  writeln('Duration: ' + FormatDateTime('nn:ss.zz', e));
end;

MSEgui code:
var
  i: integer;
  s: TDateTime;
  e: TDateTime;
begin
  s := Now;
  for i := 1 to 1000 do
  begin
    if (i mod 2) = 0 then
      tbutton1.Color := cl_Red
    else
     tbutton1.Color := cl_Blue;
    update;
  end;
  e := Now - s;
  writeln('Duration: ' + FormatDateTime('nn:ss.zz', e));
end;

MSEgui and fpGUI are double buffered (Graeme, please correct me if I am wrong 
with fpGUI).

Martin



More information about the Lazarus mailing list