ADO vs ADO Express Time Trials (redux)
- From: "Ian Boyd" <ian.borlandnews010@xxxxxxxxxxxx>
- Date: Sun, 30 Dec 2007 14:43:05 -0500
Test 1: Open results set
ADO: 8.3 seconds
ADO Express: 8.3 seconds
Test 2: Looping through a results set
ADO: 0.45 seconds
ADO Express: 338 seconds
ADO Express: 0.95 seconds (with DisableControls)
Test 3: Field Lookup by Name
ADO: 16.3 seconds
ADO Express: 130 seconds
Test 4a: Field Lookup by Ordinal
ADO: 1.6 seconds
ADO Express: 0.66 seconds
Test 5: Access field value
ADO: 14.8 seconds
ADO Express: 48.1 seconds
Total
====
Time to get it all done (field by name)
ADO
Open: 8.3s (20.8%)
Loop: 0.45s (1.1%)
Field by Name: 16.3s (40.9%)
Field Value: 14.8 (37.1%)
Total: 39.9s (100%)
ADO Express
Open: 8.3s (4.4%)
Loop: 0.95s (0.5%)
Field by Name: 130s (69.4%)
Field Value: 48.1s (25.7%)
Total: 187.35s (100%)
Time to get it all done (field by ordinal)
ADO
Open: 8.3s (33.0%)
Loop: 0.45 (1.8%)
Field by Ordinal: 1.6s (6.4%)
Field Value: 14.8s (58.8%)
Total: 25.2s (100%)
ADO Express
Open: 8.3s (14.3%)
Loop: 0.95s (1.6%)
Field by Ordinal: 0.66s (1.1%)
Field Value: 48.1s (82.9%)
Total: 48.1s (100%)
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.
.
- Follow-Ups:
- Re: ADO vs ADO Express Time Trials (redux)
- From: Lluis Olle
- Re: ADO vs ADO Express Time Trials (redux)
- From: Bill Todd
- Re: ADO vs ADO Express Time Trials (redux)
- Prev by Date: Re: ADO vs ADO Express Time Trials (redux)
- Next by Date: Re: ADO vs ADO Express Time Trials (redux)
- Previous by thread: Windows address book
- Next by thread: Re: ADO vs ADO Express Time Trials (redux)
- Index(es):
Relevant Pages
|