From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,3737542e2ed2b8e1 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!inka.de!rz.uni-karlsruhe.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail From: Albrecht =?ISO-8859-1?Q?K=E4fer?= Newsgroups: comp.lang.ada Subject: Re: Problem with optimizations Date: Tue, 28 Apr 2009 19:34:12 +0200 Organization: 1&1 Internet AG Message-ID: References: <49f73730$0$2850$ba620e4c@news.skynet.be> NNTP-Posting-Host: brln-4db91c6f.pool.einsundeins.de Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: online.de 1240940412 29958 77.185.28.111 (28 Apr 2009 17:40:12 GMT) X-Complaints-To: abuse@einsundeins.com NNTP-Posting-Date: Tue, 28 Apr 2009 17:40:12 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.21) Gecko/20090403 SeaMonkey/1.1.16 Mnenhy/0.7.5.0 Hamster-Pg/1.25.2.0 In-Reply-To: <49f73730$0$2850$ba620e4c@news.skynet.be> Xref: g2news2.google.com comp.lang.ada:5579 Date: 2009-04-28T19:34:12+02:00 List-Id: 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