[lazarus] Speaking of TMemo and RH9...

Michael Van Canneyt michael.vancanneyt at wisa.be
Thu Apr 17 02:40:22 EDT 2003




On 16 Apr 2003, Tom Lisjac wrote:

>
> I've noticed some significant speed differences between Mandrake 8.2 and
> RH9 when loading TMemo from a text file. On RH9, it took 55 seconds for
> "memo1.lines.loadfromfile('/tmp/test')" to load 1400 lines like this:
>
> 4Suite-0.11.1-13.i386.rpm
> abiword-1.0.4-2.i386.rpm
> acl-2.2.3-1.i386.rpm
> adjtimex-1.13-6.i386.rpm
> ...
>
> The same binary loaded the same text file on Mandrake 8.2 in 3 seconds.
> Both machines are 1.6 Ghz P4's with a gigabyte of ram.
>
> To make the problem go away, I did the file i/o with a separate
> stringlist... then assigned the text properties. This loaded and saved
> the file instantly on both systems:
>
>  x:=TStringlist.create;
>  x.loadfromfile('/tmp/test');
>  memo1.text:=x.text
>  ...
>
>  x:=TStringlist.create;
>  x.text:=memo1.text
>  x.savetofile('/tmp/test');
>  ...
>
> It works... but I can't help but wonder if there's a more elegant way to
> make TMemo go? :)

The TTextString (or whatever is used) implementation of TMemo.Lines
should respect the beginupdate/endupdate calls: Changes should not
be applied till the updatecount reaches zero again.

Michael.






More information about the Lazarus mailing list