[DUG]Sorting Stringlist
John Bird
johnkbird at paradise.net.nz
Thu Aug 18 16:39:07 NZST 2005
If loading a file into a stringlist and then sorting, is it in general
quicker to:
1 - MyStringList.sorted:=false;
MyStringList.LoadFromFile(filename);
MyStringList.sort;
-or-
2 - MyStringList.sorted:=true;
MyStringList.LoadFromFile(filename);
As I understand it, loadfromfile method uses add, which takes note of
whether list is to be sorted or not...
Hence case 1 just adds each new line to the end of the stringlist, case 2
adds each record to the correct sorted order place. My guess is 1 is
faster, but I am guessing.
Number of records in file may be anywhere from 10 to 100,000
John B
_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz http://ns3.123.co.nz/mailman/listinfo/delphi
More information about the Delphi
mailing list