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.237.32.140 with SMTP id 12mr11337162qtb.6.1465183482403; Sun, 05 Jun 2016 20:24:42 -0700 (PDT) X-Received: by 10.157.11.135 with SMTP id 7mr163020oth.17.1465183482367; Sun, 05 Jun 2016 20:24:42 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!p34no3151835qgp.1!news-out.google.com!107ni264qgx.1!nntp.google.com!p34no3151830qgp.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 5 Jun 2016 20:24:42 -0700 (PDT) In-Reply-To: <8af002bb-271a-4a76-b0db-097a3724f0b3@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:191:8202:8510:5985:2c17:9409:aa9c; posting-account=fdRd8woAAADTIlxCu9FgvDrUK4wPzvy3 NNTP-Posting-Host: 2601:191:8202:8510:5985:2c17:9409:aa9c References: <8af002bb-271a-4a76-b0db-097a3724f0b3@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Avoiding dispatching in procedure's with classwide types From: rieachus@comcast.net Injection-Date: Mon, 06 Jun 2016 03:24:42 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 1975 X-Received-Body-CRC: 2735734003 Xref: news.eternal-september.org comp.lang.ada:30627 Date: 2016-06-05T20:24:42-07:00 List-Id: If you want to speed things up, add a procedure that may do just that--and = time it: type Foo; procedure Operate(F: in out Foo); type Foobar is array (Integer range <>) of Foo; Now compare: for I in FB'range loop Operate(FB(I)); end loop; to: procedure Array_Operate(FB: in out Foobar) is begin for I in FB'range loop Operate(FB(I)); end loop; end Array_Operate; ... Array_Operate; This eliminates the procedure call overhead from each time around the loop.= Also note that you can extend this to the dispatching case and have only = one dispatch. (Assuming the array does not contain mixed descendants of Fo= o.) If there is a mixture? You almost certainly want the individual dispa= tches.