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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,103803355c3db607 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.228.227 with SMTP id sl3mr11216587pbc.5.1341249329898; Mon, 02 Jul 2012 10:15:29 -0700 (PDT) Path: l9ni10406pbj.0!nntp.google.com!news1.google.com!goblin2!goblin.stu.neva.ru!news.internetdienste.de!news.tu-darmstadt.de!news.belwue.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Mon, 02 Jul 2012 19:15:28 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: GNAT (GCC) Profile Guided Compilation References: <38b9c365-a2b2-4b8b-8d2a-1ea39d08ce86@googlegroups.com> <982d531a-3972-4971-b802-c7e7778b8649@googlegroups.com> <520bdc39-6004-4142-a227-facf14ebb0e8@googlegroups.com> <4ff08cb2$0$6575$9b4e6d93@newsspool3.arcor-online.net> In-Reply-To: Message-ID: <4ff1d731$0$6582$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 02 Jul 2012 19:15:29 CEST NNTP-Posting-Host: 53133973.newsspool3.arcor-online.net X-Trace: DXC=?TkUA1KJLh>_cHTX3jMOGN^^V=QGeJ X-Complaints-To: usenet-abuse@arcor.de Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Date: 2012-07-02T19:15:29+02:00 List-Id: On 02.07.12 00:57, Keean Schupke wrote: > The real benefit (and performance gains) from profile guided compilation come from correcting branch prediction. As such the gains will be most apparent when there is an 'if' statement in the inner loop of the code. Try something where you are taking the sign of an int in the formula and have three cases <0 =0 >0. Thanks for your lucid words, I was mostly guessing at what profile guided compilation might actually do. Indeed, now that I have started playing with conditionals, the translations show very different effects already, for variations of the procedure below, procedure Compute_1D (A : in out Matrix_1D) is begin for K in A'First + Len + 1 .. A'Last - Len - 1 loop case K mod Len is when 0 | Len - 1 => null; when others => A (K) := (A(K + 1) + A(K - Len) + A(K - 1) + A(K + Len)) mod Num'Last; end case; if A (K) mod 6 = 0 then A (K) := (A (K) - 1) mod Num'Last; else A (K) := K mod Num'Last; end if; end loop; end Compute_1D; Ada and C++ are mostly on a par without help from a profile (the 2D approach is still better in the Ada case; perhaps mod 6 isn't true for that many K). C++ gains 8%, Ada only 4%, though. Cheers, Georg