TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
X-To:
Date:
Sun, 3 Dec 2000 23:25:55 -0500
Reply-To:
Michael Feldman <[log in to unmask]>
Subject:
From:
Michael Feldman <[log in to unmask]>
Content-Transfer-Encoding:
7bit
In-Reply-To:
<[log in to unmask]> from "Jesse Farmer" at Dec 03, 2000 09:53:31 PM
Content-Type:
text/plain; charset=us-ascii
MIME-Version:
1.0
Parts/Attachments:
text/plain (68 lines)
[said Jesse]
>
> Actually, although he didn't specifiy it, essentially, what Stephane
> Richard was talking about was a sort of high speed database using global
> arrays.
> While I think you are quite right, that global variable are often not good,
> this is a unique application, not really typical of arrays.
> And arrays ARE the fastest form of managing lists of data in Ada right?  As
> opposed to linked lists (which are faster in C)?

It's not at all clear how you would justify the above generalization.
What on earth would make you think that arrays are necessarily faster
than linked lists in one language, and linked lists are necessarily
faster in another. Algorithm for algorithm, I'd expect the underlying
code to be essentially identical.

Perhaps, in Ada, you'd see a bit more constraint checking than in
C, but you could turn this off with pragma Suppress, if you really
wanted to benchmark it against C.

I always wonder where people come up with these strange generalizations
that "Feature X is faster in language P than in Q, while Feature Y is
faster in Q than in P."

 * * * * *

As a longtime (25 years) teacher and student of data structures,
I'd say the choice between linked lists and arrays is generally
made based on whether you can live with structures of fixed
size or you need dynamic ones.

The tradeoff is very different in this era of cheap RAM. We used
to argue for linked lists where your array would have lots of "zeroes"
or "missing values", so you could save RAM by storing only the "nonzeros"
in a linked structure. Sometimes your list-handling algorithms were
inherently slower (linear rather than constant big O to access a
given value), but sometimes you could make them faster and thus
save both space and time. At that time, nobody even dreamed of
typical PCs having 128 _mb_ RAM. Heck, 10 years ago many PC hard
disks weren't that large!

My point is that data structure design is pertty much independent
of coding language.

 * * * * *

Now, about the globals:

I was quibbling (only mildly) with the use of globals that could be
read and written from zillions of places spread across 5 packages
and a main, and opined (mildly) that this could create a debugging
nightmare, compared with a more nicely encapsulated data structure.

But this too is purely a language-independent design issue, so I
suggested we ignore it and just look at how to do it in Ada (which
was, after all, what Stephane asked).

> Stephane's application is one where you certainly wouldnt want to be
> bothered interfacing to an Access or Oracle database, or a propritary database.
>
> This is probably the best way to do this isn't it?  Via global arrays?


>
> -Jesse Farmer

Mike Feldman

ATOM RSS1 RSS2