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: a07f3367d7,8147e9052e4bc0df X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!v12g2000prb.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Child vs nested package : efficiency matter Date: Tue, 1 Jun 2010 08:03:44 -0700 (PDT) Organization: http://groups.google.com Message-ID: <37b699c4-da76-4b5f-9074-0aa465af4a19@v12g2000prb.googlegroups.com> References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1275404624 16074 127.0.0.1 (1 Jun 2010 15:03:44 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 1 Jun 2010 15:03:44 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v12g2000prb.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:12172 Date: 2010-06-01T08:03:44-07:00 List-Id: On May 29, 5:56=A0am, Yannick Duch=EAne (Hibou57) wrote: > Hillo, > > For some reasons, I've turned some nested package -- packages nested in = =A0 > the body of package -- into a set of child packages instead. > > I've noticed the application's execution time is now an average of 125% o= f =A0 > that of the old implementation. > > The implementation did not changed otherwise and is still the same. > > What can make invokation of subprograms slower when the subprograms are i= n =A0 > a child package rather than in a nested package ? > > Note: this is with optimization enabled -- with -O -- and both old and ne= w =A0 > implementation was compiled with the same options. > > I can't explain that and can't imagine a reason why. That's a mystery to = =A0 > me. I can't say anything about any particular compiler. One possibility: if procedure A calls procedure B, and A and B are in the same source, a compiler may be able to put the code of B inline in procedure A's code---i.e. the code for A will include B's code, rather than including a "call" instruction. If it does this, then in the process, it may also to be able to eliminate instructions in B's code that have no effect on A. It's a lot harder to do this if A and B are in different sources, which I'm assuming is happening if you are pulling code out of a nested package and putting it in a child package. Again, this is just a wild guess; without knowing anything about your source, and with my limited knowledge of GNAT, I can't say anything for certain. -- Adam