comp.lang.ada
 help / color / mirror / Atom feed
From: "Albrecht Käfer" <albrecht_kaefer@yahoo.de>
Subject: Re: Problem with optimizations
Date: Tue, 28 Apr 2009 19:34:12 +0200
Date: 2009-04-28T19:34:12+02:00	[thread overview]
Message-ID: <gt7f1s$t86$1@online.de> (raw)
In-Reply-To: <49f73730$0$2850$ba620e4c@news.skynet.be>

Olivier Scalbert schrieb::
> Hello,
>
> I have write a little program that try to solve Rubik's cube, just to
> practice a little Ada.
> The program is really stupid (brute force) but I have a strange problem.
> When I compile it with:
> gnatmake -O2 rubukmain, it works:
>
> Depth:  1  Positions Counter:                    12
> Depth:  2  Positions Counter:                   132
> Depth:  3  Positions Counter:                  1440
> Depth:  4  Positions Counter:                 15720
> Depth:  5  Positions Counter:                171600
> Depth:  6  Positions Counter:               1873200
> Depth:  7  Positions Counter:              20448000
> Depth:  8
> Solved !
>            1         12          8         10          2          6
>       3          3  Positions Counter:              18104705
>
> When I compile it with:
> gnatmake -O3 rubukmain, it does not work:
>
> Depth:  1  Positions Counter:                     1
> Then it stops.
>
> When, inside the Recursive_Find_Solution, I replace Is_Solved by
> Is_Solved1, then it works in all cases.
>
> I have try to understand what is happen with gdb and by having a look
> into the generated code, but without success.
>
> I have the same behaviour with:
> - Ubuntu 8.10 32 bits (GNATMAKE 4.3.2)
> - Debian testing AMD 64bits (GNATMAKE 4.3.3)

Works fine on Windows (GNAT GPL 2009).
However, I can't help but notice that you are doing premature
optimization. Did you *test* if it is faster?


Albrecht



  reply	other threads:[~2009-04-28 17:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-28 17:04 Problem with optimizations Olivier Scalbert
2009-04-28 17:34 ` Albrecht Käfer [this message]
2009-04-28 17:54   ` Olivier Scalbert
2009-04-28 18:32     ` Albrecht Käfer
2009-04-28 19:15     ` John B. Matthews
2009-04-28 18:40 ` (see below)
2009-04-28 19:05   ` Albrecht Käfer
2009-04-28 19:15     ` Olivier Scalbert
2009-04-28 19:17       ` Olivier Scalbert
2009-04-28 19:26         ` Gautier
2009-04-28 21:33       ` sjw
2009-04-29 10:36       ` johnscpg
2009-04-29 10:45       ` johnscpg
2009-04-29 13:51       ` johnscpg
2009-04-28 19:06   ` Olivier Scalbert
2009-04-28 19:12     ` (see below)
2009-04-29  2:35       ` Gene
2009-04-29  3:28         ` (see below)
2009-04-29  7:05           ` Georg Bauhaus
2009-04-28 19:46 ` Gautier
2009-04-28 20:05   ` Olivier Scalbert
2009-04-28 20:21   ` Olivier Scalbert
replies disabled

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