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: tmoran@bix.com Subject: Re: checking a loop execution Date: 2000/04/20 Message-ID: <%gxL4.1569$B43.293488@news.pacbell.net>#1/1 X-Deja-AN: 613464569 References: <8dl76u$etf$1@nnrp1.deja.com> X-Complaints-To: abuse@pacbell.net X-Trace: news.pacbell.net 956211387 206.170.2.38 (Wed, 19 Apr 2000 23:16:27 PDT) Organization: SBC Internet Services NNTP-Posting-Date: Wed, 19 Apr 2000 23:16:27 PDT Newsgroups: comp.lang.ada Date: 2000-04-20T00:00:00+00:00 List-Id: >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. If the loop typically has very few iterations, and performance is a big problem, then you probably ought to unroll the loop anyway. >In fortran the loop index is increased one last time, at the end of >the loop, Which of course is an extra increment operation, probably not a lot cheaper than "ivar := i;". You could also make your own loop with your own, lasting, control variable and your own "exit when i > 10;" to more exactly simulate the Fortran.