I was writing a Firemonkey application and ran into a problem: TMemo is painfully slow. It needs 12+ seconds to load a 3 mb file, VCL TMemo only needs 400 ms
Here is my test code:
uses
System.Threading, System.Diagnostics;
procedure TForm1.FormCreate(Sender: TObject);
begin
TTask.Run(
procedure
begin
Sleep(100);
var stopwatch := TStopwatch.Create;
TThread.Synchronize(nil,
procedure
begin
stopwatch.Start;
Memo1.Lines.LoadFromFile('../../../DemoData.json');
end);
TThread.Synchronize(nil,
procedure
begin
stopwatch.Stop;
Caption := stopwatch.ElapsedMilliseconds.ToString;
end)
end);
end;
The entire test project (including JSON file) can be found here: https://borrisholt.dk/Delphi/MemoDemo.zip
Or your can of course use your own 3mb text file.
Can anything be done or is it just the way it is with FMX?
Memo1.ControlType:=Platform;
If you do, you can get the performance in vcl.