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,f6a85e71d2c330ab X-Google-Attributes: gid103376,public From: Charles Hixson Subject: Re: checking a loop execution Date: 2000/04/20 Message-ID: <38FF3B17.D6EAC790@earthlink.net>#1/1 X-Deja-AN: 613655237 Content-Transfer-Encoding: 7bit References: <8dl76u$etf$1@nnrp1.deja.com> <%gxL4.1569$B43.293488@news.pacbell.net> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 956250908 198.94.156.19 (Thu, 20 Apr 2000 10:15:08 PDT) Organization: EarthLink Inc. -- http://www.EarthLink.net MIME-Version: 1.0 NNTP-Posting-Date: Thu, 20 Apr 2000 10:15:08 PDT Newsgroups: comp.lang.ada Date: 2000-04-20T00:00:00+00:00 List-Id: tmoran@bix.com wrote: > >I could add a control variable (ivar, in my example) to take care of the > >iteration number when exiting, but that would decrease the peformance > >of my algorithm > > Your loop as shown evaluates , and increments and tests > i and branches, up to 10 times, but assigns "ivar := i;" just once, > so setting ivar is a small part of the total time. I thought that compilers automatically detected this kind of optimization. Would unrolling the loop by hand actually be a good idea? Or would it be an optimization that defeated itself as frequently as it helped? (Actually, my expectation would be that it would defeat itself more often than it helped.)