Registriert seit: 24. Sep 2005
483 Beiträge
Delphi 2010 Architect
|
AW: Große Textdateien verarbeiten
7. Apr 2011, 16:04
Hm also ich hab jetzt grad schonmal gemessen und bin zu folgendem Ergebnis gekommen:
Code:
file: 20mb, 1372022 Lines
time: 10:34 min
Delphi-Quellcode:
begin
StartTime:=Time;
Memo1.Lines.BeginUpdate;
for i:=1 to Form1.StringGrid1.RowCount do
begin
Path:=Form1.StringGrid1.Cells[1,i];
if FileExists(Path) then
begin
AssignFile(F,Path);
Reset(F);
while not eof(F) do
begin
Readln(F,tmp);
Form1.Memo1.Lines.Add(tmp);
end;
CloseFile(F);
end;
end;
Memo1.Lines.EndUpdate;
EndTime:=Time;
ShowMessage('Time: '+TimeToStr(EndTime-StartTime));
end;
Code:
file: 20mb, 1372022 Lines
time: 00:22 min
Delphi-Quellcode:
begin
StartTime:=Time;
sl:=TStringList.Create;
for i:=1 to Form1.StringGrid1.RowCount do
begin
Path:=Form1.StringGrid1.Cells[1,i];
if FileExists(Path) then
begin
AssignFile(F,Path);
Reset(F);
while not eof(F) do
begin
Readln(F,tmp);
sl.Add(tmp);
end;
CloseFile(F);
end;
end;
Memo1.Text:=sl.Text;
sl.Free;
EndTime:=Time;
ShowMessage('Time: '+TimeToStr(EndTime-StartTime));
end;
|
|
Zitat
|