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: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson) Subject: Re: C's register keyword Date: 1997/09/09 Message-ID: <5v3v3o$np5@mulga.cs.mu.OZ.AU>#1/1 X-Deja-AN: 271052814 References: <5uqhm2$t48$1@goanna.cs.rmit.edu.au> <5v1k1v$3mq6$1@prime.imagin.net> Organization: Comp Sci, University of Melbourne Newsgroups: comp.lang.ada Date: 1997-09-09T00:00:00+00:00 List-Id: 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 | "I have always known that the pursuit WWW: | of excellence is a lethal habit" PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.