comp.lang.ada
 help / color / mirror / Atom feed
From: Rod Kay <charlie@mullum.com.au>
Subject: Re: Profiling Gnat re. pthread_malloc, pthread_getspecific, system   finalisation & tasking.
Date: Mon, 25 Jun 2001 01:25:25 -0400
Date: 2001-06-25T01:25:25-04:00	[thread overview]
Message-ID: <3B36CB45.137D30C5@mullum.com.au> (raw)
In-Reply-To: 5F6Z6.118864$%i7.83650084@news1.rdc1.sfba.home.com

tmoran@acm.org wrote:
> 
> > > (Mandrake 8.0) machine. I've used inlining, O3 optimisation, and
> > > disabled all run-time 
> >
> > By "using inlining" do you mean pragma Inline?  Did you also specify -gnatn?

     I'm using Gnat's pragma Inline_Always, which I believe operates
regardless of the -gnatn switch. (I had trouble linking when I tried
pragma Inline & -gnatn.)


>   A 10x difference in speed is unlikely to be caused by, or solved by,
> any of those things.

    Yes, as it turns out the problem was unrelated to the optimisation
controls. A critical function dereferenced a forward reference type
(from John G. Volan's forward reference package), resulting in an
instance of one of my types being created and used, in place of the
instance actually referred to. This type contained a Container from the
Booch Components, which is a controlled type. The creation/destruction
overhead, incurred each time the procedure was called, essentially
crippled the program.

    As it turns out the forward reference was unnecessary, a relic from
an earlier circular elaboration problem, and performance improved
markedly when it was removed.



> 
> > Somehow your Ada code does not correspond to your C++ code, regarding
> > threads.
>     Likely.  Though there may also be an optimization opportunity in
> making it *less* like the C.  I'm thinking in particular of getting
> rid of malloc's by using local (stack) declarations instead.  Ada
> programs typically use heap allocation a lot less.


    I've found that the AWS comms packages I'm using (in an unrelated
area of the application), makes use of Ada's tasking. The AWS packages
are not used in the processing which I'm profiling, but their presence
seem to impose a tasking overhead on all subprograms. When I removed the
AWS packages from the program, the pthread_* and system__tasking__*
subprograms vanished from the profile results.


    The program is now performing only a little below the c++ version,
and with a little more optimisation, I'm hoping to equal or exceed that.
Thanks to all for your time and advise.



regards,

Charles.



  reply	other threads:[~2001-06-25  5:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-23  7:34 Profiling Gnat re. pthread_malloc, pthread_getspecific, system finalisation & tasking Charles Darcy
2001-06-23 10:57 ` Profiling Gnat re. pthread_malloc, pthread_getspecific, system Larry Kilgallen
2001-06-23 19:26 ` Profiling Gnat re. pthread_malloc, pthread_getspecific, system finalisation & tasking Pat Rogers
2001-06-23 20:06   ` tmoran
2001-06-25  5:25     ` Rod Kay [this message]
2001-06-25  5:42       ` Charles Darcy
replies disabled

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