From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,42dee056ce900ae6 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: C's register keyword Date: 1997/09/11 Message-ID: #1/1 X-Deja-AN: 271637346 References: <5uqhm2$t48$1@goanna.cs.rmit.edu.au> <5v1k1v$3mq6$1@prime.imagin.net> <5v3v3o$np5@mulga.cs.mu.OZ.AU> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-09-11T00:00:00+00:00 List-Id: 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.