>From about 4500 ms (on my machine) to 390 ms. for 10000 items in the box... machine is p4 2.2 with 256 rdram
view raw code below... (you need to include mmsystem for gettickcount). procedure TForm1.Button1Click(Sender: TObject); var i: Integer; lst: cardinal; lstr: String; slTemp: TStringList; begin lst := gettickcount; slTemp := TStringList.Create; // with ListBox1.Items do begin label1.caption:='Process - adding qualifiers'; ListBox1.Items.beginupdate; for I := 0 to ListBox1.items.count-1 do begin lStr := ListBox1.Items[i] + '\*.*'; // lStr := lStr //ListBox1.Items[i] := lStr;//ListBox1.Items[i] + '\*.*'; slTemp.Add(lStr); // Strings[i]:=Strings[i]+'\*.*'; end; ListBox1.Items.endupdate; end; ListBox1.Items.Assign(slTEmp); slTemp.Free; label1.caption := format('%d ms', [Gettickcount - lst]); end; procedure TForm1.Button2Click(Sender: TObject); var i: Integer; begin for i := 1 to 10000 do begin ListBox1.Items.Add(Format('xsddsfsdfc_%d', [i])); end; end; Alistair George <[EMAIL PROTECTED] To: Multiple recipients of list delphi <[EMAIL PROTECTED]> z> cc: Sent by: Subject: [DUG]: Speed of code owner-delphi@del phi.org.nz 16/10/2002 02:32 AM Please respond to delphi Hi again. Here is a routine which seems to run really slowly - any ideas why? and if so, what suggested solution tks, Al+ with FileListbox.Items do begin label1.caption:='Process - adding qualifiers'; beginupdate; for I := 0 to FileListbox.items.count-1 do Strings[i]:=Strings[i]+'\*.*'; endupdate; end; --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the [EMAIL PROTECTED] --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/