[Lazarus] Memo.Lines.BeginUpdate

Vincent Snijders vincent.snijders at gmail.com
Fri Mar 8 14:43:18 CET 2013


2013/3/8 Juha Manninen <juha.manninen62 at gmail.com>:
> Hi
>
> Shouldn't the BeginUpdate and EndUpdate in TMemo.Lines prevent the GUI
> from updating, thus allowing quickly adding many lines?

Yes.

>
> I made a test app which generates a big amount of random data and has
> 2 methods to add it to a Memo.
> 1. uses a temporary StringList and finally calls Assign.
> 2. adds the strings directly to Memo.Lines between BeginUpdate and EndUpdate.
>
> Method number 1. is about 40 times faster!
> I expected method number 2. to be the fastest.

Why? There is lot of comminucation between the LCL and widgetset, even
if the widgetset doesn't paint any update with method 2.

>
> The strange thing is that Assign() also uses BeginUpdate and
> EndUpdate, and then calls AddStrings() which has its own BeginUpdate
> and EndUpdate.
> IMO it should behave identically with Memo.Lines.Add inside
> BeginUpdate / EndUpdate.

It is different and noticeable.

Vincent




More information about the Lazarus mailing list