Delphi-PRAXiS
Seite 2 von 3     12 3      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Desaströse Performance von TRichedit (https://www.delphipraxis.net/215812-desastroese-performance-von-trichedit.html)

himitsu 12. Sep 2024 13:35

AW: Desaströse Performance von TRichedit
 
TextDateien ohne Formatierung ... warum überhaupt in ein RichEdit anstatt in ein Memo?

Uwe Raabe 12. Sep 2024 14:01

AW: Desaströse Performance von TRichedit
 
Zitat:

Zitat von himitsu (Beitrag 1540874)
TextDateien ohne Formatierung ... warum überhaupt in ein RichEdit anstatt in ein Memo?

Na ja, weil:
Zitat:

Zitat von Maekkelrajter (Beitrag 1540834)
Aber einige optische Gimmicks wie mehrfarbiger Text sind eben mit einem TMemo nicht zu realisieren.


Kas Ob. 12. Sep 2024 14:52

AW: Desaströse Performance von TRichedit
 
Well, if someone reading my writing somewhere, then try this

Delphi-Quellcode:
var
  Stream:TMemoryStream;
begin
  Stream := TMemoryStream.Create;
  try
    Stream.LoadFromFile(FILE_NAMEXX);
    Stream.Position := 0;
    RichEdit1.Lines.LoadFromStream(Stream);
  finally
    Stream.Free;
  end;
end;
The problem is known, which is the ****** stream handling in RTL, and also in VCL, it does many small read at 2kb (like it was bronze age) instead of 64kb, anyway TMemoryStream will load this stuff in full in memory and feed it, this should be faster, (Well in theory and in my slow brain)

Uwe Raabe 12. Sep 2024 15:05

AW: Desaströse Performance von TRichedit
 
Zitat:

Zitat von Kas Ob. (Beitrag 1540877)
Well, if someone reading my writing somewhere, then try this

Sorry, no difference. The problem is most likely inside Windows.

himitsu 12. Sep 2024 15:08

AW: Desaströse Performance von TRichedit
 
Zitat:

Zitat von Uwe Raabe (Beitrag 1540876)
Zitat:

Zitat von himitsu (Beitrag 1540874)
TextDateien ohne Formatierung ... warum überhaupt in ein RichEdit anstatt in ein Memo?

Na ja, weil:
Zitat:

Zitat von Maekkelrajter (Beitrag 1540834)
Aber einige optische Gimmicks wie mehrfarbiger Text sind eben mit einem TMemo nicht zu realisieren.


ups.

SynEdit/SynMemo oder dergleichen?
oder das neue Direct2D-RichEdit ... müsste man doch bestimmt gut im FireMokey einbinden können.
(der Start von dem Geraffel dauert zwar ewig, aber danach scheint es schnell zu sein)

Kas Ob. 12. Sep 2024 15:16

AW: Desaströse Performance von TRichedit
 
What about this
Delphi-Quellcode:
var
  Stream: TMemoryStream;
begin
  Stream := TMemoryStream.Create;
  try
    Stream.LoadFromFile(FILE_NAME);
    SendMessage(RichEdit1.Handle, WM_SETTEXT, LPARAM(0), WPARAM(Stream.Memory)); // better to add to the stream another byte with 0 or double bytes with 0, but for testing now
    //Stream.Position := 0;
    //RichEdit1.Lines.LoadFromStream(Stream);
  finally
    Stream.Free;
  end;
end;

himitsu 12. Sep 2024 15:23

AW: Desaströse Performance von TRichedit
 
Zitat:

Zitat von Kas Ob. (Beitrag 1540886)
What about this

And this is supposed to work in a Delphi since 2009?

SendMessage = SendMessageW = Unicode
Is your file also Unicode?

Kas Ob. 12. Sep 2024 15:29

AW: Desaströse Performance von TRichedit
 
Zitat:

Zitat von himitsu (Beitrag 1540887)
Zitat:

Zitat von Kas Ob. (Beitrag 1540886)
What about this

And this is supposed to work in a Delphi since 2009?

SendMessage = SendMessageW = Unicode
Is your file also Unicode?

It should !

Notice by sending the stream in full as it in the file, meaning the header included U+FEFF BOM header, yet the Window class recognized it, and handle it right, this even should work with Delphi 5.

But was it faster ?

Uwe Raabe 12. Sep 2024 15:31

AW: Desaströse Performance von TRichedit
 
Zitat:

Zitat von himitsu (Beitrag 1540887)
Is your file also Unicode?

At least the example files posted above are.

Anyway, the TMemoryStream approach is quite similar to setting the Text or SelText with a string. It doesn't affect the performance, though.

Maekkelrajter 12. Sep 2024 15:33

AW: Desaströse Performance von TRichedit
 
Zitat:

Zitat von Uwe Raabe (Beitrag 1540873)
Warum die doppelt so große Windows-Datei aber nur 1/4 der Zeit braucht erschließt sich mir noch nicht so ganz.

Ich vermute, es liegt an der Codierung unter MacOS. Zum Beispiel werden Umlaute im normalen Text anders codiert als solche im Dateipfad
Beispiel Track 4344
Titel: Morgendämmerung und Siegfried's Rheinfahrt aus "Götterdämmerung". Der Code für 'ä' = $E4 00
Im Dateipfad "Macintosh HD/Users/.../05 Morgendämmerung und Siegfried's Rheinfahrt aus _Götterdämmerung_.m4a" ist der Code für 'ä'= $61 00 08 03 (a + ¨).
Wenn ich mit Trichedit.FindText nach 'dämmerung' suche, wird nur das Vorkommen im Text, nicht aber das im Dateipfad gefunden
Ich habe allerdings keine Ahnung, warum sich das so gravierend auf die Ausführungszeit auswirkt.

Gruß LP


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:39 Uhr.
Seite 2 von 3     12 3      

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz