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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,56525db28240414a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Received: by 10.224.177.12 with SMTP id bg12mr1453890qab.0.1343315973479; Thu, 26 Jul 2012 08:19:33 -0700 (PDT) Received: by 10.66.72.165 with SMTP id e5mr1625701pav.4.1343314958707; Thu, 26 Jul 2012 08:02:38 -0700 (PDT) Path: a15ni113198934qag.0!nntp.google.com!q21no5008111qas.0!news-out.google.com!b9ni61428159pbl.0!nntp.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!t1g2000pbl.googlegroups.com!not-for-mail From: Robin Vowels Newsgroups: comp.lang.ada Subject: Re: Efficient Sequential Access to Arrays Date: Thu, 26 Jul 2012 07:47:14 -0700 (PDT) Organization: http://groups.google.com Message-ID: <32f60786-0236-4277-b936-f87b1cb8045b@t1g2000pbl.googlegroups.com> References: <01983f1c-f842-4b1f-a180-bcef531dad4c@googlegroups.com> <87ipdf4vh6.fsf@mid.deneb.enyo.de> <4ce44d2d-d789-42a0-a6ed-035f7f8d58be@googlegroups.com> NNTP-Posting-Host: 123.2.70.40 Mime-Version: 1.0 X-Trace: posting.google.com 1343314958 24528 127.0.0.1 (26 Jul 2012 15:02:38 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 26 Jul 2012 15:02:38 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t1g2000pbl.googlegroups.com; posting-host=123.2.70.40; posting-account=S_MdrwoAAAD7T2pxG2e393dk6y0tc0Le User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20100101 Firefox/13.0.1,gzip(gfe) X-Received-Bytes: 2719 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-07-26T07:47:14-07:00 List-Id: On Jul 25, 5:09=A0pm, Niklas Holsti wrote: > On 12-07-24 19:00 , rrr...@gmail.com wrote: > > For the PL/I optimising compiler for the CDC Cyber (c. 1980), > > multiplication was eliminated for matrix elements > > by using a table of offsets into each row. > > Thus, double subscripting reduced to simple addition. > > That sounds like a specific choice of code generation for arrays, rather > than a general optimization. It was a general optimisation for matrices, with significant benefits for intensive use of subscripting. Optimisation comes from a number of optimisation strategies, not just one. > Keean could simulate this code by defining the array as a > one-dimensional array of one-dimensional arrays (rows), which would > replace the row-length multiplication by an additional indexing. > > >> (We are of course (I believe) assuming that index range checks are > >> turned off.) > > > Index range checks should be left on. > > Sure, in general. But here the OP (Keean) is trying to beat the > performance of C++ that uses pointers without index checks. Enabling > index checks in the Ada code would probably (in this case, where the > algorithm has scatterered indexing of the array) slow it by an amount > that swamps the effect of the multiplication optimization. There's really no point in executing code without such checks. You may never know that there is a bug in the code.