Re: ADO vs ADO Express Time Trials (redux)
- From: "Steve Zimmelman" <skz@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 2 Jan 2008 19:01:15 -0500
I'm curious...
Is
FName := VarAsString(Recordset.Fields.Item['Name']) ;
Faster than
FName := VarAsString(Recordset.Fields['Name']) ;
?
-Steve-
"Ian Boyd" <ian.borlandnews010@xxxxxxxxxxxx> wrote in message
news:4777f4e9$1@xxxxxxxxxxxxxxxxxxxxxxxxx
Summary
Your database work will be 80% faster if you change any code that is of
the form:
procedure GetValuesFromQuery(Query: TADOQuery);
begin
FName := Query.FieldByName('Name').AsString;
FAddress := Query.FieldByName('Address').AsString;
...
end;
to
procedure GetValuesFromQuery(Query: TADOQuery);
begin
GetValuesFromRecordset(Query.Recordset);
end;
procedure GetValuesFromRecordset(Recordset: ADOInt._Recordset);
begin
FName := VarAsString(Recordset.Fields.Item['Name']);
FAddress := VarAsString(Recordset.Fields.Items['Address']);
...
end;
ADO Express is much slower than ADO. Even ADO hobbled with by name field
lookups is faster than ADO Express by ordinal. You can use ADO Express to
open a query, but as soon as you do bypass anything written by Borland and
go straight to the
ADOQuery.Recordset
to perform all your field and value lookups. The largest single
performance penalty is trying to access a field value in ADO Express. ADO
Express provides to way to access a field's underlying Variant value.
Because of this, you have to access the field through the
Query.Recordset.Fields collection.
i originally posted this 2 years ago (http://tinyurl.com/33ygmg). It was
time to revisit it because i was once again trying to make things faster,
and i forgot a lot of the specifics that i had discovered.
.
- Prev by Date: Re: ADO vs ADO Express Time Trials (redux)
- Next by Date: Re: Querying a MS SQL View...
- Previous by thread: Re: ADO vs ADO Express Time Trials (redux)
- Next by thread: Re: Querying a MS SQL View...
- Index(es):
Relevant Pages
|
|