Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-05

Painting performance

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Roland Turcan

Hello Lazarus mailing list!

I am still porting our application from Delphi/Kylix to Lazarus and the performance of the same units responsible for graphical output are nearly the same, but the performance on Lazarus Carbon/Gtk2 is much slower than on VCL/CLX.

What would you recommend to find out the bottleneck of the performance. Maybe it is in some part of code about painting which must be rewritten for performance improvement on LCL.

Thanks for all recommendations in advance.

Reply by email

Mattias Gaertner
to Roland Turcan
Show quoted text 6 lines
Hello Lazarus mailing list! I am still porting our application from Delphi/Kylix to Lazarus and the performance of the same units responsible for graphical output are nearly the same, but the performance on Lazarus Carbon/Gtk2 is much slower than on VCL/CLX.

1. The gtk drawing functions are per se slower than the winapi functions.
2. To achieve Delphi compatible drawing the LCL has to combine several gtk functions to get the same effect of one winapi function. Especially the specialized functions, that are fast under winapi, have no direct counterpart in the gtk. And Delphi programs use mostly the fast functions of the winapi.
3. system colors (e.g. clBtnFace) are gradients and images under gtk, while under winapi they are simple colors.

What would you recommend to find out the bottleneck of the performance. Maybe it is in some part of code about painting which must be rewritten for performance improvement on LCL.

Try to reduce the number of drawing operations. For example don't use Get/SetPixel. Use a polygon instead of MoveTo/LineTo. Use default fonts and text styles. Use default Brush and Pen styles. Draw to a memory bitmap and draw that. See my other mail about fpcanvas and aggpas.
There are plans to accelerate aggpas by drawing directly to the widgetset image buffers.

Use gprof to find out where the bottleneck is.

Thanks for all recommendations in advance.

Mattias

Reply by email

zeljko
to Roland Turcan: Hello Lazarus mailing list! I am still porting our application from Delphi/Kylix to…
Roland Turcan wrote 12 lines
Hello Lazarus mailing list! I am still porting our application from Delphi/Kylix to Lazarus and the performance of the same units responsible for graphical output are nearly the same, but the performance on Lazarus Carbon/Gtk2 is much slower than on VCL/CLX. What would you recommend to find out the bottleneck of the performance. Maybe it is in some part of code about painting which must be rewritten for performance improvement on LCL. Thanks for all recommendations in advance.

Why don't you use Lazarus Qt ? I've ported all our apps from CLX and it works ok.

zeljko

Reply by email