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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.70.103.67 with SMTP id fu3mr3600985pdb.6.1410509163705; Fri, 12 Sep 2014 01:06:03 -0700 (PDT) X-Received: by 10.140.21.51 with SMTP id 48mr6686qgk.12.1410509163436; Fri, 12 Sep 2014 01:06:03 -0700 (PDT) Path: buffer1.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!r10no620279igi.0!news-out.google.com!q8ni9qal.1!nntp.google.com!s7no225858qap.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 12 Sep 2014 01:06:03 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2.150.33.164; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR NNTP-Posting-Host: 2.150.33.164 References: <0868c42e-ed44-4b36-a929-2bffb338ee34@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <10864291-3b56-4c08-af10-15301096e8d5@googlegroups.com> Subject: Re: Assuming optimization? What is best of these code alternatives? From: reinkor Injection-Date: Fri, 12 Sep 2014 08:06:03 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: number.nntp.dca.giganews.com comp.lang.ada:188979 Date: 2014-09-12T01:06:03-07:00 List-Id: OK, thanks so far. I may have oversimplified in my example. The expression "i1 + i2" may be replaced by something more complex such as an ordered set (container). Here is a copy from my "real code" where A and B are (container) ordered sets. Is it any point to store the result from the following set operations before entering the loops here ? AandB := A and B; AmB := A - B; AmC := A - C; BmA := B - A; -- obs "set minus" = { x | x \in B and x not \in A) CmA := C - A; for j in pos1.j + 1 .. pos2.j - 1 loop for i in pos1.i + 1 .. pos2.i - 1 loop Bpos := (i,j) + Br0; Cpos := (i,j) + Cr0; img2(i,j) := RelInf(i,j,img1,AmB); if not Rel(img2(i,j),img2(Bpos.i,Bpos.j)) then if (for some E of BmA => Rel(img1(i + E.i,j+E.j),img2(Bpos.i,Bpos.j))) then img2(i,j) := RelInf(i,j,img1,AmC); if not Rel(img2(i,j),img2(Cpos.i,Cpos.j)) then if (for some E of CmA => Rel(img1(i + E.i,j+E.j),img2(Cpos.i,Cpos.j))) then img2(i,j) := RelInf(i,j,img1,AandB); else img2(i,j) := img2(Cpos.i,Cpos.j); end if; end if; else img2(i,j) := img2(Bpos.i,Bpos.j); end if; end if; end loop; end loop;