Well, not to labor a point, but I will present my case...
Delphi "string" is a 4 byte pointer, a known quantity (4 bytes) residing in memory, or residing in a (String) list. On the other hand, comma delimited text is an unknown quantity that must be parsed from char[1] to (last) Char[x], for each and every row, or each and every column.
This is the rational behind "TStrings.Assign", which is (much) quicker than parsing comma delimited text. The compiler can iterate 4 byte pointers represent each cell in a complete row or column in a StringGrid. Conveniently, these Rows and Columns are predefined as TStrings types by Delphi.
Granted, a database is somewhat cumbersome depending on the nature of any given application, but its added value for speed cannot be easily brushed aside. Delphi packaged a working database with its product. Nevertheless, a flat file can save multiple TString objects using Delphi's Reader and Writer classes
@ DanaPaul very interesting..
Is it from the Theory possible to make it with a Listbox too ??
because..I the normal load procedure is fast by me....
the only problem is whenn the ItemtxtFile ist to large..
here my normaly Load-Procedure...
(as Listbox I`m using the LMDListbox)
-----------------------------------------------------------
procedure LoadAudioFiles (o:Tstrings;L:TLMDListBox);
var
i :Integer;
TempFile :TCSTAudioFileReader;
BPM: string;
begin
TempFile := TCSTAudioFileReader.Create(nil);
for I :=0 to o.Count -1 do begin
If ((FileExists(o[i]))and (TempFile.CheckValueFileTyp(o[i])= true))then begin
TempFile.FileName := o[i];
BPM := '120,00';
If o.Count > 20 then begin
L.Items.BeginUpdate;
L.Items.Add ((TempFile.FileName)+';'+inttostr(l.Count+1)+';'+AnsiUppercase(TempFile.Artist)+';'+AnsiUppercase(TempFile.Title)+';'+TempFile.DurationTime+' '+';'+BPM+';'+(inttostr(TempFile.DurationInt))+';'+TempFile.Typ);
L.Items.EndUpdate;
end
else
L.Items.Add ((TempFile.FileName)+';'+inttostr(l.Count+1)+';'+AnsiUppercase(TempFile.Artist)+';'+AnsiUppercase(TempFile.Title)+';'+TempFile.DurationTime+' '+';'+BPM+';'+(inttostr(TempFile.DurationInt))+';'+TempFile.Typ);
end;
end;
TempFile.Free;
end;
This will work very well...without problems...
The only Problem what I have is....
when I try this...(and i have to much Items > 5000)
LockWindowUpdate(PlayList1.Handle);
PlayList1.items.loadfromfile(progdir+playlist1.txt);
LockWindowUpdate(0);
Mabe i must generate a new Load procdue the will be work faster.....
Greets
Chris
Ps
Thanks for all you help...you are a refinement for this board....
---------------------------------------------------------
@ Fred.....
I see that your Search-Procedure is very slow...
if you want i can send you the code of a faster Search-Procedure
On my Athlon 1800
for 11.000 Songs ca 4 minutes....
Chris