Autor Beitrag
AScomp
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 162


Delphi 5, Delphi 7, Delphi 2007, Delphi 2009, Delphi XE, Delphi 10 Seattle
BeitragVerfasst: Do 12.01.12 16:42 
Hallo,

habe momentan ein etwas kurioses Problem und sehe eigentlich fast nur eine mögliche Ursache:

Mein Programm enthält eine Funktion, die eine Datei kopiert. Bisher war die Funktionsdeklaration wie folgt:

MyCopyFile(Source, Target: PChar): Boolean;

Aufgrund einer Änderung braucht die neue Funktion allerdings noch eine Stringlist, in der alle kopierten Dateien enthalten sind:

MyCopyFile(Source, Target: PChar; CopiedFiles: TStringList): Boolean;

Kann es sein, dass der blose Funktionsaufruf von MyCopyFile (wird mehrere Tausend Mal aufgerufen, da es sich für gewöhnlich um sehr viele Dateien handelt) mit Übergabe der TStringList deutlich langsamer wird - vor allem dann, wenn CopiedFiles viele Einträge enthält?

Habe testhalber schon alles, was mit CopiedFiles innerhalb der MyCopyFile passiert, auskommentiert. Die Frage ist also, ob allein durch Übergabe der StringList eine starke Verlangsamung eintreten kann.

Danke und Gruß

Andy
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19338
Erhaltene Danke: 1752

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 12.01.12 16:49 
Da werden nur ein paar Assemblerbefehle mehr ausgeführt. Alleine durch die Übergabe des zusätzlichen Pointers darf die Geschwindigkeit eigentlich nicht signifikant abnehmen.
AScomp Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 162


Delphi 5, Delphi 7, Delphi 2007, Delphi 2009, Delphi XE, Delphi 10 Seattle
BeitragVerfasst: Do 12.01.12 16:54 
Okay, dann kann es das wohl auch nicht sein - danke dir!

-> if (ProgOptions.FollowLinks = true) or ((ProgOptions.FollowLinks = false) and (SearchRec.Attr and faSymLink = 0)) then begin

Das ist noch eine neue Zeile, die erst in der neuen Version kam. Allerdings ist es doch so, dass der zweite Teil gar nicht mehr überprüft wird, wenn bereits der erste Teil (ProgOptions.FollowLinks = true) wahr ist, oder täusche ich mich?
Tranx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 648
Erhaltene Danke: 85

WIN 2000, WIN XP
D5 Prof
BeitragVerfasst: Do 12.01.12 18:12 
Das hängt davon ab, ob Du die Option "Boolesche Ausdrücke vollständig" unter ProjektOptionen->Compiler aktiviert hast oder nicht. Bei Aktivierung werden solche Abfragen vollständig abgearbeitet, wenn nicht, nur solange, bis das Ergebnis eindeutig ist (FALSE).

_________________
Toleranz ist eine Grundvoraussetzung für das Leben.
AScomp Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 162


Delphi 5, Delphi 7, Delphi 2007, Delphi 2009, Delphi XE, Delphi 10 Seattle
BeitragVerfasst: Do 12.01.12 18:27 
Alles klar, danke!

Die Option ist bei mir nicht aktiviert, also alles so, wie ich es gewohnt bin und wie es von mir gewünscht ist.

Dann muss ich das Problem anderswo suchen.