Delphi/Paradox vs VB/Access 
Author Message
 Delphi/Paradox vs VB/Access

Hi guys, had some spare time today, and thought I'd try to compare the
speed of the two development tools that have occupied most of my time
lately.

Hopefully the results will aid the company I work for choose the right
tool (use the force Luke!) for the right job, so I thought I'd lay'em out
for you guys and watch as you slaughter my findings. :-)

As for myself, I'm a biased Turbo Pascal programmer that was hired to
do VB/Access stuff one year ago. December/January I started experimenting
with delphi (using the Preview CD). I still maintain VB code, but I try to
use Delphi as much as possible for future projects. We're currently trying
to decide whether or not to convert existing projects as well. My preliminary
testresults are supposed to give food for thought.

I started out with one Access database and one Paradox table. Both
were identical and only contained three fields: ID, Test_Text (50 char),
Rnd_Number (short integer).

The database contains 12358 records with ID as a Primary Key (Counter).
TEST.MDB became rather small 524.288 bytes, while TESTTBL.DB occupied as
much as 706.560 bytes (perhaps saving room for future records?).

The applications have a listbox on the left side of the form, one label
and a Text/Edit control on the right side. Panels in Delphi made the form
look quite fancy, the Videosoft Elastic controls didn't quite provide the
desired effect so I won't mention them again. I sized the listbox controls
so that they become almost the same size (in the respective vb/delphi
versions).

(Excuse the Quick'n'dirty look of the code, it's only suitable for testing
purposes)
Here goes VB:

Option Explicit
Dim hotbase As database
Dim tbl As table

Declare Function GetTickCount Lib "User" () As Long

Sub Form_Load ()
Dim li&
  Set hotbase = OpenDatabase("E:\dbgrid~1\test.mdb")
  Set tbl = hotbase.OpenTable("TestTbl")
  li = GetTickCount()  'start "timer" to measure how long it takes to fill
  Do While Not tbl.EOF 'the listbox.
    list1.AddItem tbl("Test_Text")
    list1.ItemData(list1.NewIndex) = tbl("ID")
    tbl.MoveNext
  Loop
  tbl.Index = "PrimaryKey"
  li = GetTickCount() - li
  label1 = li          'label1 shows the score...
End Sub

'Selecting an item in the listbox will display the corresponding
'RndNumber field. label1 shows either 0 or 64ms. The timer updates 18.2 times
'pr second btw. Measuring the seek time, proved here to only add to the
'overhead, but that's ok. :-)
Sub List1_Click ()
Dim li&
  li = GetTickCount()    
  tbl.Seek "=", list1.ItemData(list1.ListIndex)
  Text1 = tbl("RndNumber")  
  li = GetTickCount() - li
  label1 = li
End Sub

VB scores on my humble 486DX33 running NT:
Listbox fill w/itemdata: 45312, 44864, 55616, 53376, 54208 and 54656ms.
(between 44 and 55 seconds i.e.)
Scroll listbox top to bottom (using page down) took exactly 60 seconds
(on my stopwatch).

In the first two/three runs I had Access loaded in a separate memory space,
and that affected the score somewhat. (I didn't need accurate scores here,
you'll soon see why)

I could implement the Delphi app by using a TDBGrid. The database grid
control seemed to not load everything at once, and thus only aquired a
second or two to initialise. No fun. (BTW: On the scroll top-bottom test,
it had similar performance as VB, i.e. in the 60-70 seconds area)

I.e. no code was required if I had chosen the simple route.

But, this test was to check out the listbox controls, and I made two
discoveries (oki, so I'm more or less a listbox {*filter*}, don't taunt me!):
 - The listbox is limited to 65535 (2^16-1) items. I'm sure this could be
   easily expanded if I had been smart enough to buy the VCL source.
 - No ItemData! However, Borland did make it possible to insert an object
   while inserting the string. A highly *flexible* solution, although a bit
   more difficult to implement (the first time). This solution produced
   no real performance hit either. A VB fill without itemdata was clocked to
   29312ms, while my first attempt in Delphi clocked in at 26000-something.
   Not a big difference at first (without filling in itemdata) i.e..

The Delphi app, btw, looks like this:

type TItemData=class
  itemdata:longint;
end;

procedure TForm1.FormCreate(Sender: TObject);
var li:longint;
id:TItemData;
begin
  table1.open;
  li:=GetTickCount; {start timer... Fill ahead!}
  while not table1.eof do
  begin
    id:=TItemData.Create;
    id.itemdata:=table1id.value;
    listbox1.items.addobject(table1test_text.value,id);
    table1.next;
  end;
  li:=GetTickCount-li; {finished!}
  label1.caption:=IntToStr(li);
end;

procedure TForm1.ListBox1Click(Sender: TObject);
var li:longint;
id:TItemData;
begin
  li:=GetTickCount;
  table1.FindKey([(listbox1.items.objects[listbox1.itemindex]
                   as TItemdata).itemdata]);
  Edit1.Text:=table1RndNumber.AsString;
  li:=GetTickCount-li;
  label1.caption:=IntToStr(li);
end;

The score:
Delphi fill w/itemdata: 33280, 33152, 30720, 27328.
(the last score was obtained running standalone, I think)

Scroll top to bottom clocked in at 26 seconds. The scroll was definately
smoother and felt natural.

VB's best "listfilling" score: 44864ms, while the bottom-top scroll
was 60 seconds.

Comments, anyone? Are my results somewhat sane?

=\
 *=- R.Moberg, author of CD-Player Pro! ftp.cica.indiana.edu:
=/                                      /win3/sounds/cdppro45.zip



Fri, 02 Jan 1998 03:00:00 GMT  
 Delphi/Paradox vs VB/Access
: Hi guys, had some spare time today, and thought I'd try to compare the
: speed of the two development tools that have occupied most of my time
: lately.

You DO have tooo much spare time :)

I did the same thing with an app I was developing.  It's basically
a browsing util with about 1300-1400 records containing the name
of a card, descriptions and other stats including a memo field.
It will allow the user to search for a card name by typing just
the first few letters and scroll down to the correct cell of the grid.

The dis/advantage of Delphi/Paradox other than a compiled program, I found:

Interactive search was possible and really fast with no delay.  The
SQL query for displaying a certain type of cards was slow, with about
3-5 seconds of delay.

The damn SQL/DB engine with all the DLLs (I think 5 or more files) were
more than 1.2 megs.

The dis/advantage of Access/VB other than all the VBRUN/etc. I found:

Interactive search was not possible since FindFirst with partial
field was slow.  The SQL query was fast with almost no delay.

The VB Jet engine was about 800+ K, so the jury is still out on
which one was better, but I distributed the Delphi version anyway. :)

GL



Fri, 09 Jan 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB vs VB Prof vs Delphi

2. Access vs VB in Paradox 7 tables

3. MS Access databases Pros and Cons of using VB vs DELPHI

4. MS Access Pros and cons of using VB vs DELPHI

5. VB vs Delphi vs VC++

6. vb vs vb4 vs delphi 2

7. (VFP 3.0 vs 5.0) vs Delphi and Visual Basic

8. VisualBasic vs PowerBuilder vs Delphi

9. VB.Net vs Delphi

10. VB.NET vs DELPHI another perspective

11. VB.NET vs DELPHI

12. vb vs delphi

 

 
Powered by phpBB® Forum Software