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=ham 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-7-bit Received: by 10.66.75.201 with SMTP id e9mr1481920paw.22.1343317633962; Thu, 26 Jul 2012 08:47:13 -0700 (PDT) Path: p10ni65184440pbh.1!nntp.google.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!backlog2.nntp.ams.giganews.com!border4.nntp.ams.giganews.com!nntp.giganews.com!ramfeed-1.ams.xsnews.nl!feed.xsnews.nl!border-1.ams.xsnews.nl!newsfeed.straub-nv.de!news.swapon.de!news.glorb.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Keean Schupke Newsgroups: comp.lang.ada Subject: Re: Efficient Sequential Access to Arrays Date: Sat, 21 Jul 2012 01:24:19 -0700 (PDT) Organization: http://groups.google.com Message-ID: <72dbbd45-320b-436a-9d81-fcb6d02504e1@googlegroups.com> References: <9d4d4463-4c7e-40f4-a167-933eb056c6a5@googlegroups.com> <5007ecf3$0$9507$9b4e6d93@newsspool1.arcor-online.net> <3dbfa883-54c8-4269-a567-26dde8ead4cd@googlegroups.com> NNTP-Posting-Host: 82.44.19.199 Mime-Version: 1.0 X-Trace: posting.google.com 1342859059 8214 127.0.0.1 (21 Jul 2012 08:24:19 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 21 Jul 2012 08:24:19 +0000 (UTC) In-Reply-To: <3dbfa883-54c8-4269-a567-26dde8ead4cd@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=82.44.19.199; posting-account=T5Z2vAoAAAB8ExE3yV3f56dVATtEMNcM User-Agent: G2/1.0 X-Original-Bytes: 3110 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-07-21T01:24:19-07:00 List-Id: I have re-implemented the code to use array indexing, but with the improvem= ents I made in the profile-guided thread. The indexed code does not use 'ac= cess' variables at all, but uses 'renames' and 'in out' functions (from Ada= -2012), except for the one function discussed below. Current performance is: Relative Addressing code 57,000 simulations per second Array Indexing code 42,000 simulations per second So the relative addressing code is 36% faster. I have some ideas to improve= the array indexed version, as the element size is no longer a power of two= that may be having some affect. I can also pack the data structure tighter= as I think I can fit it in 16 bytes now I only have to store two 16bit ind= exes instead of two 64bit addresses.=20 In rewriting this code I came across the following issue, that I have not y= et found a totally satisfactory solution to. I have an ADT representing the= disjoint set, but the element stored in it is limited and I cannot return = it from a function. I have several options: 1) throw away structured programming and make everything happen in one pack= age directly on the array, hurting readability, understandability, maintain= ability and losing the ability to separately test and validate the code. 2) make the array part of the public interface for the package, breaking en= capsulation and the ability to separately test and validate the code. 3) return an access, however to avoid an access level violation I have to p= ass an access to the ADT into this function instead of the ADT itself. Ignoring performance which is the best way to structure this? Is there anot= her way I have missed? Cheers, Keean.