comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Interesting performance quirk.
Date: Tue, 28 Oct 2008 10:21:54 -0400
Date: 2008-10-28T10:21:54-04:00	[thread overview]
Message-ID: <wccbpx4ztod.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 4906f908$0$5781$4d3efbfe@news.sover.net

"Peter C. Chapin" <pcc482719@gmail.com> writes:

> I'm expecting my code to be slower because a) It is Ada and there are
> probably some extra run time checks, ...

You should also compile with all checks suppressed, to determine the
cost of the checks.  This doesn't mean you have to suppress all checks
in order to get good performance.  After this experiment, you might be
able to determine that suppressing checks in some inner loop (e.g. the
procedure you intend to inline, and its call site(s))) is good enough.

>... and b) I just wrote this thing and
> I haven't yet tried to tweak it for performance.

Sure.

> I tried running gprof over my code to see what I could learn, but I
> don't know how to use that tool very well yet so I didn't learn much.

It's worth learning.  The gprof output can be confusing at first, but if
you puzzle over it for a while, it begins to make more sense.  ;-)

>...I
> discovered that a certain procedure is called a HUGE number of times,
> but that's not unexpected considering where it's used. It's a small
> procedure so I might try inlining it.

It might also make sense to look at the machine code for that procedure.
And/or look at the expanded Ada code (using gnat's -gnatG switch).

You might also want to profile the C version, and look at whatever
tricks it uses in its inner loops, and perhaps duplicate them in
the Ada version.

Please continue to report your progress here.  I, and I'm sure others,
are interested.

- Bob



  reply	other threads:[~2008-10-28 14:21 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-26  0:57 Interesting performance quirk Peter C. Chapin
2008-10-26  2:15 ` Jeffrey Creem
2008-10-26 11:16   ` Peter C. Chapin
2008-10-26  4:57 ` tmoran
2008-10-26 11:11   ` Peter C. Chapin
2008-10-28  8:49     ` Martin
2008-10-28 11:35       ` Peter C. Chapin
2008-10-28 14:21         ` Robert A Duff [this message]
2008-10-29  1:42           ` Peter C. Chapin
2008-10-28 18:27         ` Jeffrey R. Carter
2008-10-29  1:39           ` Peter C. Chapin
2008-10-29  5:27             ` Jeffrey R. Carter
2008-10-28 23:22         ` Ludovic Brenta
2008-10-29  8:42           ` oenone
2008-10-29  9:59           ` Peter C. Chapin
2008-10-29 10:19             ` Martin
2008-11-17  6:31             ` David Thompson
2008-11-17 11:51               ` Peter C. Chapin
2008-10-29  9:54         ` Alex R. Mosteo
2008-10-30 11:16           ` Peter C. Chapin
2008-10-29 16:12         ` Colin Paul Gloster
2008-10-30 11:23           ` Peter C. Chapin
2008-10-31 13:41             ` Colin Paul Gloster
2008-11-01 15:41               ` Gene
2008-10-29 20:18 ` Florian Weimer
2008-10-30 11:15   ` Peter C. Chapin
2008-11-07  0:44 ` Randy Brukardt
2008-11-07  1:23   ` Peter C. Chapin
replies disabled

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