comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Child vs nested package : efficiency matter
Date: Tue, 1 Jun 2010 08:03:44 -0700 (PDT)
Date: 2010-06-01T08:03:44-07:00	[thread overview]
Message-ID: <37b699c4-da76-4b5f-9074-0aa465af4a19@v12g2000prb.googlegroups.com> (raw)
In-Reply-To: op.vdgww3flxmjfy8@garhos

On May 29, 5:56 am, Yannick Duchêne (Hibou57)
<yannick_duch...@yahoo.fr> wrote:
> Hillo,
>
> For some reasons, I've turned some nested package -- packages nested in  
> 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% of  
> 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 in  
> a child package rather than in a nested package ?
>
> Note: this is with optimization enabled -- with -O -- and both old and new  
> implementation was compiled with the same options.
>
> I can't explain that and can't imagine a reason why. That's a mystery to  
> 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



  parent reply	other threads:[~2010-06-01 15:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-29 12:56 Child vs nested package : efficiency matter Yannick Duchêne (Hibou57)
2010-05-30  1:17 ` BrianG
2010-06-01 15:03 ` Adam Beneschan [this message]
2010-06-01 15:34   ` Yannick Duchêne (Hibou57)
2010-06-01 15:38     ` Adam Beneschan
2010-06-01 19:04     ` Simon Wright
2010-06-01 19:11       ` Yannick Duchêne (Hibou57)
2010-06-02 11:11         ` -gnatN breakage was: " Alex R. Mosteo
2010-06-02 14:39           ` Vadim Godunko
2010-06-02 16:45             ` Georg Bauhaus
2010-06-02 16:50               ` Yannick Duchêne (Hibou57)
2010-06-02 20:35               ` Vadim Godunko
2010-06-01 18:35 ` Adam Beneschan
2010-06-01 19:09   ` Yannick Duchêne (Hibou57)
2010-06-01 19:44     ` Adam Beneschan
2010-06-01 19:56       ` Yannick Duchêne (Hibou57)
2010-06-02  1:38     ` BrianG
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox