[DUG] Speed of loading a Client DataSet
John Bird
johnkbird at paradise.net.nz
Thu Dec 6 20:51:49 NZDT 2007
I tried a different loop using code like
tbData.Fields[5].asString:=copy(Buffer,22,30); //name
tbData.Fields[6].asString:=copy(buffer,52,30); //desc
And found it was pretty much the same amount of time - that is eliminating
the FieldByName seems to make no appreciable difference. In this case 66000
records take 36 seconds. The same procedures on a file with 15000 records
take around 6 seconds, so there is an effect of it slowing down the larger
the datasets get.
John
Hi John
TDatset.FieldByName is slow - and you're repeating it 15,000X5 times.
Much better to declare 5 TField type vars, use TDataSet.FindField or
TDataSet.FieldByName to assign them prior to the loop.
See how you get on.
More information about the Delphi
mailing list