From: Keean Schupke <keean.schupke@googlemail.com>
Subject: Re: GNAT (GCC) Profile Guided Compilation
Date: Sat, 14 Jul 2012 15:32:49 -0700 (PDT)
Date: 2012-07-14T15:32:49-07:00 [thread overview]
Message-ID: <e70a8424-47df-4141-a0ac-2e0bc6fbfc77@googlegroups.com> (raw)
In-Reply-To: <a6e3v8FvsvU1@mid.individual.net>
On Saturday, 14 July 2012 21:43:20 UTC+1, Niklas Holsti wrote:
> On 12-07-14 23:17 , Keean Schupke wrote:
> >
> > Okay, I think I have tracked down the performance problem, but I am
> > not sure how to fix it. It would appear that C++ code that returns a
> > boolean from a function, generates a decision tree using tests and
> > branches, whereas Ada is setting the result into a Boolean variable.
> > This has the result that C++ is bailing out of the evaluation as soon
> > as it can (IE if one side of an and is false, or one side of an or is
> > true), but Ada is always evaluating all parts of the expressions.
> >
> > Is this a difference in language semantics, and what is the best way
> > to deal with it? Do I need to rewrite all 'and' and 'or' statements
> > in conditionals as nested if statements to get the evaluate only as
> > far as necessary semantics like C/C++?
>
> Use the short-circuit forms of "and" and "or": "and then" and "or else".
>
> --
> Niklas Holsti
> Tidorum Ltd
> niklas holsti tidorum fi
> . @ .
Yes, this appears to be the biggest cause of the profile guided compilation not working as well for Ada as C++. With the short-circuit forms I get the following speeds (thousands of simulations per second).
C++: 40k, profile-guided: 56k
Ada: 40k, profile-guided: 54k
So thats a huge improvement (up from 46k to 54k).
Cheers,
Keean.
next prev parent reply other threads:[~2012-07-14 22:32 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-29 9:17 GNAT (GCC) Profile Guided Compilation Keean Schupke
2012-06-29 9:34 ` Dmitry A. Kazakov
2012-06-29 10:01 ` Keean Schupke
2012-06-29 10:24 ` Keean Schupke
2012-06-29 12:26 ` stefan-lucks
2012-06-29 12:51 ` Keean Schupke
2012-06-29 12:05 ` Dmitry A. Kazakov
2012-06-29 10:48 ` Simon Wright
2012-06-29 11:14 ` Keean Schupke
2012-06-29 12:39 ` gautier_niouzes
2012-06-29 12:52 ` Keean Schupke
2012-06-29 14:14 ` gautier_niouzes
2012-06-29 15:05 ` gautier_niouzes
2012-06-29 17:03 ` Keean Schupke
2012-07-01 9:29 ` Georg Bauhaus
2012-07-01 17:45 ` Georg Bauhaus
2012-07-01 22:57 ` Keean Schupke
2012-07-02 17:15 ` Georg Bauhaus
2012-07-02 17:26 ` Keean Schupke
2012-07-02 23:48 ` Keean Schupke
2012-07-04 10:38 ` Georg Bauhaus
2012-07-04 10:57 ` Keean Schupke
2012-07-04 12:36 ` Mark Lorenzen
2012-07-04 12:38 ` Georg Bauhaus
2012-07-14 20:17 ` Keean Schupke
2012-07-14 20:33 ` Keean Schupke
2012-07-14 20:43 ` Niklas Holsti
2012-07-14 22:32 ` Keean Schupke [this message]
2012-07-14 23:40 ` Keean Schupke
2012-07-15 7:15 ` Niklas Holsti
2012-07-15 8:27 ` Keean Schupke
2012-07-18 10:01 ` Georg Bauhaus
2012-07-18 17:36 ` Keean Schupke
2012-07-19 5:42 ` Georg Bauhaus
2012-07-19 10:18 ` Keean Schupke
2012-07-15 11:02 ` Niklas Holsti
2012-07-15 12:48 ` Keean Schupke
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox