It's hard to believe that loading 900 strings into a TMemo and then deleting 400 to keep 500 lines would take as long as a minute.
But you are right. I am attaching a little demo with two buttons: the first one adds 1000 random strings to a memo, the second one deletes always the first string as long as 900 strings are left. Although in this example only 100 strings are deleted it takes 12 seconds on my pc (Win 10).
Debugging into the Delete(0) leads me into the widget set, and for Windows I see this code:
procedure TWin32MemoStrings.Delete(Index: integer);
var
LineStart,
LineEnd: Integer;
begin
LineStart := GetLineStart(Index);
LineEnd := GetLineStart(Index+1);
if LineEnd < 0 then LineEnd := LineStart+GetLineLength(Index);
SendMessageW(FHandle, EM_SETSEL, LineStart, LineEnd);
SendMessageW(FHandle, EM_REPLACESEL,0 , lparam(PWChar('')));
end;
The SendMessageW instructions communicate with the operating system, this is because the strings are not stored by the memo, but by the widgetset. This probably is the explanation why the Deleting process is so awfully slow.
However, when I bypass the widgetset by first copying the memo lines to a temporary stringlist, deleting the strings in the stringlist and copying the remaining strings back to the memo, the process is as fast as expected.
I get the same behavior when I run the same project in Delphi XE10.3. So, are you really doing the same when you make the observation that delphi is much faster than Lazarus here?