![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 2 of 2 total |
![]() |
Mon, Dec 1 2008 1:25 PM | Permanent Link |
Roy Lambert NLH Associates ![]() | Normally I try to use persistent fields, but when using a unit without form, or passing the table as a parameter, I use FieldByName and I just decided to do a check of differences in speed. I wrote a really sophisticated test program (below) and the results were
Persistent field 234 FieldByName 2834 Direct index 188 Even though its a fast PC and gettickcount isn't massively accurate I'm still impressed with FieldByName. Roy Lambert procedure TForm1.Button13Click(Sender: TObject); var lc: integer; t1, t2, t3, t4: integer; junk: integer; const Loops = 1000000; sig = '_Sig'; begin Users.Open; t1 := gettickcount; for lc := 1 to loops do begin junk := Users_sig.AsInteger; end; t2 := gettickcount; for lc := 1 to loops do begin junk := Users.FieldByName(sig).AsInteger; end; t3 := gettickcount; for lc := 1 to loops do begin junk := Users.Fields[12].AsInteger; end; t4 := gettickcount; showmessage('_Sig: ' + IntToStr(t2 - t1) + #13 + 'fieldbyname: ' + inttostr(t3 - t2) + #13 + '[]: ' + inttostr(t4 - t3)); end; |
Mon, Dec 1 2008 2:15 PM | Permanent Link |
Tiago Ameller | Roy,
<<Even though its a fast PC and gettickcount isn't massively accurate I'm still impressed with FieldByName. >> In remote Delphi 2.0 times, I ran a similar test, with similar results. My opinion is in most cases, there is not significative difference using persistent fields or fieldbyname. In a user interactive process, this difference does not matter. |
This web page was last updated on Wednesday, July 2, 2025 at 06:46 PM | Privacy Policy![]() © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |