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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f03ffdf470e3c559 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!u28g2000hsc.googlegroups.com!not-for-mail From: Martin Newsgroups: comp.lang.ada Subject: Re: Interesting performance quirk. Date: Wed, 29 Oct 2008 03:19:53 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <4903c066$0$28676$4d3efbfe@news.sover.net> <49045079$0$28711$4d3efbfe@news.sover.net> <4906f908$0$5781$4d3efbfe@news.sover.net> <34e18564-7913-426a-bb26-324314791d32@d1g2000hsg.googlegroups.com> <490833fc$0$5742$4d3efbfe@news.sover.net> NNTP-Posting-Host: 20.133.0.8 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1225275593 23217 127.0.0.1 (29 Oct 2008 10:19:53 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 29 Oct 2008 10:19:53 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: u28g2000hsc.googlegroups.com; posting-host=20.133.0.8; posting-account=g4n69woAAACHKbpceNrvOhHWViIbdQ9G User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8249 Date: 2008-10-29T03:19:53-07:00 List-Id: On Oct 29, 9:59=A0am, "Peter C. Chapin" wrote: > In any event I don't want to "resort" to assembly language or to > removing the Ada mandated checks (at least not in the final version). With a bit of care a lot of checks can be avoided or removed by the compiler. A fairly common example of this wrt loops is: type Array_Index_Type is range ...; type Array_Type is array (Array_Index_Type) of ...; procedure Example (A : Array_Type) is begin for I in Array_Index_Type loop -- Do something with array I - a check is often included end loop; end Example; is better written as: procedure Example (A : Array_Type) is begin for I in A'Range loop -- Do something with array I - no need for a check end loop; end Example; I'm not a language lawyer, so I can't tell if that's compiler inefficiencies or what the language requires but this was certainly the behaviour of several compilers I've used***. Cheers -- Martin *** I haven't checked this recently!!! :-)