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: 103376,103803355c3db607 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.241.162 with SMTP id wj2mr1570941pbc.2.1340964467350; Fri, 29 Jun 2012 03:07:47 -0700 (PDT) Path: l9ni32886pbj.0!nntp.google.com!news2.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Keean Schupke Newsgroups: comp.lang.ada Subject: Re: GNAT (GCC) Profile Guided Compilation Date: Fri, 29 Jun 2012 03:01:30 -0700 (PDT) Organization: http://groups.google.com Message-ID: <62d099a8-d754-4c13-b8c8-d8eea2d6a764@googlegroups.com> References: NNTP-Posting-Host: 82.44.19.199 Mime-Version: 1.0 X-Trace: posting.google.com 1340964467 19626 127.0.0.1 (29 Jun 2012 10:07:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 29 Jun 2012 10:07:47 +0000 (UTC) Cc: mailbox@dmitry-kazakov.de In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=82.44.19.199; posting-account=T5Z2vAoAAAB8ExE3yV3f56dVATtEMNcM User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-06-29T03:01:30-07:00 List-Id: 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: >=20 > > Anyone have any ideas why profile guided compilation performs so poorly > > with Ada compared to C++? >=20 > 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 th= an > in C. To beat C, the precondition is to design it in Ada way. >=20 > --=20 > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de I don't think you are right here, but I would be happy to be proved wrong.= =20 In general I find the choice of algorithm dominates performance. In this ca= se most of the performance is dominated by a disjoint-set (union-find) algo= rithm operating on an array of data. The data nominally represents a 2D spa= ce (although I am using a 1D array to avoid the cost of multiplication on e= very access). Most operations access the neighbouring cells, hence require a +/- one cell= , or +/- one row operations. Maintaining the address of the current cell is faster than using indexed ad= dressing (mainly because of the extra parameter that needs to be passed aro= und increasing the pressure on register allocation). I would be interested to understand how an algorithm can be implemented in = a more Ada way? Cheers, Keean.