🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #4190

Research results on ADO and ADOExpress...

#4190
From: Jurko
Date: Sat, 16 Mar 2002 12:37
78 lines
4917 bytes
Ok here are the results of my little research into ADO and
ADOExpress

Original problem description:
-----------------------------
Forms in a project I'm involved in were opening too slow. The most
complicated form taking up to 5 seconds to open.

Problem analysis:
-----------------
1. The forms seem to be taking more time to open when there are many
    datasets on the form with many fields in them. The slowest form had
    about 15 datasets with each about 30 fields and 3 of the datasets had
    up to 100 fields. (Note that I'm not describing here how or why it
    came to that form having so many data on it)
2. Adding other form elements doesn't seem to effect the form creation
    time but doubling the number of datasets seems to double the time
    needed for the form to open.
3. The datasets used on that form are TADODatasets which have their
    ADODB.Recordset objects created on the form startup using the
    TADODataset::CreateDataSet() method. Later they are filled with data
    but that is not done until some GUI interaction with the user is done so
    that does not affect us in this case.
4. Tracking to the source I found CreateDataSet() calls to be the culprit.
5. Creating the same ADODB.Recordset objects in VB was done pretty
    much instantly (under 20 miliseconds).
6. Creating the recordsets directly using ADO in C++ builder achieved
    the same performance.
7. Tracking the VCL source code led me to the
    TADODataSet::InternalInitFieldDefs() method - particularly to the
    creation of the TFieldDef objects for integer fields.
8. Profiling showed that that the F.Properties[SIsAutoInc] call in that
    method was taking too long. F here is a pointer to the ADODB.Field
    COM object. Properties has a default array property Items which takes
    a wide string or an integer as a parameter and returns a pointer to the
    ADODB.Property object.
9. This call is used on integer fields to check whether the field in
question
    has the autoIncrement flag set or not. In this project no autoIncrement
    fields are used. That property is automattically added to all fields by
    ADO on field creation - that was checked from VB as well as BCB.
10. More precisely accessing that property was slow, and whether it was
    accessed by index or by name didn't make a noticable difference. The
    only thing that made a difference was the total number of fields in the
    recordset. From that I guess that all the propertys for all the
recordset
    fields are kept internally in one big datastructure not too well
optimized
    for looking up one given property.
11. The same behavior was duplicated in VB just to make sure that it had
    nothing to do with ADOExpress TADODataSet wrapper implementation.

Solution:
---------
1. I copied the ADODB.pas VCL unit to the project and modified it so
    setting up autoincrement flags for the recordset fields can be removed
    on compilation using a precompiler directive and made the project use
    that version of TADODataSet wrappers.

Results:
--------
1. The speed at which many of the forms in the project open has been
    drastically increased. Dropping the time needed to open the most
    complex form from 5 to under 1 second.
2. The difference between the time needed to directly create the
    ADODB.Recordset objects needed and the time needed to create
    the ADODB.Recordset objects through ADOExpress seems to
    suggest that there are further unnecessary parts of ADOExpress that
    can be optimized or removed if unnecessary. No other uses of the
    ADODB.Recordset's Properties collection were found in
    ADOExpress.

If anyone knows any place that this kind or similar information on ADO
objects and ADOExpress can be found I'd be more than grateful if you
could point it out for me.

Hope this helps someone...
    Jurko
Technical Details
Message-ID: <a9ev6a.c5o.ln@news.ve-mil.hr>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!hub1.nntpserver.com!news-out.spamkiller.net!propagator-la!news-in-la.newsfeeds.com!news-in.superfeed.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews!news.ve-mil.hr!nobody

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,349c0f39f0c3db92,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-03-16 05:12:24 PST
From: "Jurko" <Jurko@ve-mil.hr>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Research results on ADO and ADOExpress...
Date: Sat, 16 Mar 2002 13:37:43 +0100
Lines: 80
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <a9ev6a.c5o.ln@news.ve-mil.hr>
NNTP-Posting-Host: 195.29.221.130
X-Trace: dnews 1016282731 195.29.221.130 (16 Mar 2002 04:45:31 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!hub1.nntpserver.com!news-out.spamkiller.net!propagator-la!news-in-la.newsfeeds.com!news-in.superfeed.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews!news.ve-mil.hr!nobody