comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: Ada-95 for numerics?
Date: 1996/04/01
Date: 1996-04-01T00:00:00+00:00	[thread overview]
Message-ID: <dewar.828416445@schonberg> (raw)
In-Reply-To: 316005FE.204F@escmail.orl.mmc.com

"BTW: The other compilers you mentioned are all more "mature" than
GNAT. This means they have had way more time to work on optimizations."

Actulally GNAT is rather strange in this respect. The gcc backend is
*quite* "mature", and often generates code that compares with the
best code generated by any compiler for any language on a given
machine.

If you write Ada that corresponds to the stuff gcc knows how to do well,
then you can encounter performance levels that look VERY good, often
much better than other Ada (or C) compilers.

On the other hand, it is quite true that the GNAT front end is quite young,
and some of the code for Ada specific constructs (e.g. exceptions,
aggregates, finalization, slices, runtime checks) is far from optimal,
and can be expected to improve significantly as time goes by!

We certainly are interested in detailed reports (with code) for examples
where GNAT seems slow. It is important to give the exact code. Often
it is the case that the performance is VERY dependent on small details
of how the code is written.

Let me give a specific example, to see what I mean:

procedure a is
   x : integer;
   subtype r is integer range x .. x + x;
   type a is array (r) of integer;
   va : a;
begin
   for j in r loop
      va(j) := 0;
   end loop;

   for j in a'range loop
      va(j) := 0;
   end loop;
end a;

Now these two loops should obviously be treated exactly the same. But
in fact the first loop is treated optimally, with no junk checks, and
generates essentially perfect machine code. But the second loop generates
a silly check inside the loop. The fix is actually quite simple (it might
get into 3.04, we only noticed this anomoly recently). Certainly it is
on the list. 

Note: I had to use a dynamic range here, if I had written range 1 .. 10
for r, then the code for both loops would have been fine.





  reply	other threads:[~1996-04-01  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-01  0:00 Ada-95 for numerics? Joerg Rodemann
1996-04-01  0:00 ` Robert Dewar
1996-04-02  0:00   ` michael
1996-04-01  0:00 ` Ted Dennison
1996-04-01  0:00   ` Robert Dewar [this message]
1996-04-02  0:00 ` Dale Stanbrough
1996-04-03  0:00 ` Robert I. Eachus
  -- strict thread matches above, loose matches on Subject: below --
1996-04-02  0:00 Joerg Rodemann
1996-04-02  0:00 ` Robert Dewar
1996-04-02  0:00 Jean-Pierre Rosen
1996-04-03  0:00 ` Robert I. Eachus
1996-04-05  0:00  Dr J Parker
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox