comp.lang.ada
 help / color / mirror / Atom feed
From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: C's register keyword
Date: 1997/09/09
Date: 1997-09-09T00:00:00+00:00	[thread overview]
Message-ID: <5v3v3o$np5@mulga.cs.mu.OZ.AU> (raw)
In-Reply-To: 5v1k1v$3mq6$1@prime.imagin.net



dweller@news.imagin.net (David Weller) writes:

>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.

--
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.




  reply	other threads:[~1997-09-09  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 [this message]
1997-09-11  0:00       ` Robert Dewar
replies disabled

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