comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com
Subject: Re: checking a loop execution
Date: 2000/04/20
Date: 2000-04-20T00:00:00+00:00	[thread overview]
Message-ID: <%gxL4.1569$B43.293488@news.pacbell.net> (raw)
In-Reply-To: 8dl76u$etf$1@nnrp1.deja.com

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




  parent reply	other threads:[~2000-04-20  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-19  0:00 checking a loop execution pumilia
2000-04-19  0:00 ` DuckE
2000-04-20  0:00 ` Geoff Bull
2000-04-20  0:00 ` Andreas Schulz
2000-04-20  0:00 ` tmoran [this message]
2000-04-20  0:00   ` Charles Hixson
2000-04-20  0:00 ` chad
2000-04-21  0:00   ` Robert Dewar
2000-04-21  0:00   ` Robert Dewar
2000-04-22  0:00     ` Chad R. Meiners
2000-04-23  0:00       ` Robert Dewar
2000-04-24  0:00         ` Ehud Lamm
2000-04-24  0:00           ` Ehud Lamm
2000-04-24  0:00       ` Bill Greene
replies disabled

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