comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: C's register keyword
Date: 1997/09/11
Date: 1997-09-11T00:00:00+00:00	[thread overview]
Message-ID: <dewar.873981889@merv> (raw)
In-Reply-To: 5v3v3o$np5@mulga.cs.mu.OZ.AU


Fergus says, replying to Dave

<<>C version:
>
>       for (int i = 0; i < 10000; i++)
>               for (int j = 0; j < 10000; j++)
>                               /*some nontrivial statement*/
>
>Ada version:
>
>       for i in 0..9999 loop
>               for j in 0..9999 loop
>                       --some nontrivial statement
>               end loop;
>       end loop;
>
>Using gcc/GNAT, you find that the Ada executable yields faster
>performance (assuming same optimization levels and identical times for
>the "some nontrivial statement".

I find that very hard to believe.
Perhaps I have misunderstood some of your assumptions.

Certainly if `i' and `j' are local (auto) variables whose
address is not taken, then gcc will (at -O1 or higher) put
them in registers, so I don't see why the Ada version would
be faster than the C version.>>



Well certainly religeon as in belief is not necessary in discussing this
issue. Simply compile both examples, and you will see that in general
Fergus is correct, the assembler code is identical for the two cases. 
I did not see the original post, so I am not sure why Dave would have
thought otherwise.






      reply	other threads:[~1997-09-11  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-06  0:00 C's register keyword Tristan Ludowyk
1997-09-06  0:00 ` Tarjei T. Jensen
1997-09-10  0:00   ` Richard Kenner
1997-09-08  0:00 ` Tucker Taft
1997-09-08  0:00   ` David Weller
1997-09-09  0:00     ` Fergus Henderson
1997-09-11  0:00       ` Robert Dewar [this message]
replies disabled

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