[comp.lang.ada] The danger of comparing languages

linnig@skvax1.csc.ti.COM (Mike Linnig) (06/02/88)

Jerry Callen writes:

> In case you can't tell, I wrote both the Ada and (shudder) Cobol code
> for this "benchmark" (such as it is). Many years ago I did commercial
> programming for online systems in Cobol. I KNOW Cobol. Why I'm admitting
> this in public I don't know. :-)   I have been writing Ada for 2 years,
> I think it's fair to say that I KNOW Ada, too. I can see advantages and
> disadvantages to writing data processing code in Ada rather than Cobol.
> But to use this ONE crude test to claim that "Cobol outperforms Ada by
> 50%" is baloney.

You have to be very careful in this type of comparison, even if
you do lots of different test programs in both languages.

The Cobol program was probably written by someone that know
which features were inefficent, and they avoided them.  We are only
beginning to discover what those features are in Ada.  If both
programs were written using the "identical algorithm" the Ada
version may be slower because that algorithm used an inefficient Ada
feature.  A knowlegable Ada programmer may be able to rewrite the
same program to execute much more efficiently.

My favorite example of this is the Pascal pointer type.  Most
folks would translate them into an Ada access type.   I've worked
with one Ada compiler that automatically created an access collection
(heap) when a new access type was declared.  Heaven forbid you 
should declare an access type in a frequently called procedure.  This
doesn't mean that you cannot use access types, it just means you need
to declare them once (say in a package).

	Mike Linnig,
	Texas Instruments

sommar@enea.se (Erland Sommarskog) (06/09/88)

Mike Linnig (linnig@skvax1.csc.ti.COM) writes:
>My favorite example of this is the Pascal pointer type.  Most
>folks would translate them into an Ada access type.   I've worked
>with one Ada compiler that automatically created an access collection
>(heap) when a new access type was declared.  Heaven forbid you 
>should declare an access type in a frequently called procedure.  This
>doesn't mean that you cannot use access types, it just means you need
>to declare them once (say in a package).

Oh, for God's sake, no! Such regards should be avoided except in
extreme emergency. Ada gives you the chance to clearly express
what you are doing and to do things general and reuseable. Don't 
obsucre the code by doing unnatural things just because your
compiler behaves in a certain way. The compiler behaviour you 
describe sounds very inapproiate and should reported as a 
deficiency.
-- 
Erland Sommarskog           
ENEA Data, Stockholm        
sommar@enea.UUCP            
Mail your NO votes for rec.music.rock to: jfc%Athena.mit.edu@mit-eddie.UUCP