[DUG] performance of Bulk runtime Component creation
Myles Penlington
myles at ams.co.nz
Thu Sep 18 11:32:35 NZST 2008
No. Do not use LockWindowUpdate - is likely to fail. Was not designed
for this purpose.
We do however use (doubles the speed of form creation).
SendMessage( AForm.Handle, WM_SETREDRAW, 0, 0); //Disable
redrawing of the main window stuff until the new screen has been created
Try
..
finally
SendMessage( AForm.Handle, WM_SETREDRAW, 1, 0); //Turn
drawing on again.
InvalidateRect( 0, nil, True ); //Cause all
windows to be redrawn!
End
- it does however introduce redrawing issues, in that while a form is
being created you get bleed through from other underlying application
windows if the user moves the mouse a lot - mind you it prob depends on
which windows you turn redraw off.
You can of course create forms/panels/controls in the background/not
visible and then just compose them and make them visible when required.
There are other things you can do to speed up Delphi in significant ways
- e.g. changes classes.component implementation of InsertComponent,
notifications etc. There are a few n squared algorithms hiding in the
TComponent class, which become significant when adding/removing lots of
components (the order can/does make a difference).
E.g. If you use a sorted TList instead and a binary search etc.
Of course it is best to run a performance profiler on the situation to
find the real causes.
Myles.
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
On Behalf Of Edwin Das
Sent: Thursday, 18 September 2008 11:15 a.m.
To: 'delphi at delphi.org.nz'
Subject: [DUG] performance of Bulk runtime Component creation
Hi All
I was wondering what the most efficient way is of creating many runtime
controls of various classes in Delphi.
So for each component you need to
Create it and set some properties.
Is there a trick you can apply this to process that would speed it up?
I am thinking along the lines of maybe using lockwindowsupdate on either
all controls or the root container control.
I am wondering what else can be done to speed up this process.
Kind regards,
Edwin Das
MYOB Enterprise Division
Attention:
This communication is confidential and may be legally privileged. If you are not the intended recipient, please do not use, disclose, copy or distribute it, other than to return it to us with your confirmation that it has been deleted from your system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20080918/7cac7bcd/attachment.html
More information about the Delphi
mailing list