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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC 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.196.232 with SMTP id ip8mr1835031pbc.6.1340971555990; Fri, 29 Jun 2012 05:05:55 -0700 (PDT) Path: l9ni33196pbj.0!nntp.google.com!news1.google.com!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: GNAT (GCC) Profile Guided Compilation Date: Fri, 29 Jun 2012 14:05:59 +0200 Organization: cbb software GmbH Message-ID: References: <62d099a8-d754-4c13-b8c8-d8eea2d6a764@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-06-29T14:05:59+02:00 List-Id: On Fri, 29 Jun 2012 03:01:30 -0700 (PDT), Keean Schupke wrote: > On Friday, 29 June 2012 10:34:19 UTC+1, Dmitry A. Kazakov wrote: >> On Fri, 29 Jun 2012 02:17:19 -0700 (PDT), Keean Schupke wrote: >> >>> Anyone have any ideas why profile guided compilation performs so poorly >>> with Ada compared to C++? >> >> Probably because you programmed it using low level C-ish stuff like >> addresses instead of accessing data directly. In general, if you write a C >> program in Ada (or any other language), you cannot expect it do better than >> in C. To beat C, the precondition is to design it in Ada way. > In general I find the choice of algorithm dominates performance. In this > case most of the performance is dominated by a disjoint-set (union-find) > algorithm operating on an array of data. The data nominally represents a > 2D space (although I am using a 1D array to avoid the cost of > multiplication on every access). That still does not justify machine addresses or pointers to limited targets. I would not be so sure that access to 2D array is slower when done by the compiler. That depends on too many factors. I also do not know what effect has profiling on inlining and optimizations of generic instances in presence of numerous very short subprograms. I guess that should severely distort the picture, maybe beyond recognition. I must admit it, I never used gcc profiling any seriously, instead, I always did direct time measures. If performance is OK without profiling, why do you care? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de