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 sl3mr6830343pbc.5.1342350153551; Sun, 15 Jul 2012 04:02:33 -0700 (PDT) Path: l9ni11739pbj.0!nntp.google.com!news2.google.com!news4.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: GNAT (GCC) Profile Guided Compilation Date: Sun, 15 Jul 2012 14:02:31 +0300 Organization: Tidorum Ltd Message-ID: 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> <4ff1d731$0$6582$9b4e6d93@newsspool3.arcor-online.net> <4ff41d38$0$6577$9b4e6d93@newsspool3.arcor-online.net> <26b778c4-5abc-4fbf-94b0-888c2ce71831@googlegroups.com> <4ff43956$0$6576$9b4e6d93@newsspool3.arcor-online.net> <2dba1140-4f28-4fb8-ace4-2c10f3a02313@googlegroups.com> Mime-Version: 1.0 X-Trace: individual.net ve3AVv0uRi2MS3AVpp4npwpAHB5+mCaxIPoW7cfo6jwajhbn51mpoNXLuJahmKj8Pf Cancel-Lock: sha1:AfI388+49m55xPvxVQHqNSGDhvY= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-07-15T14:02:31+03:00 List-Id: On 12-07-15 10:15 , Niklas Holsti wrote: > It seems to me that the general belief, regarding the expected relative > speeds of the short-circuit code versus the long-circuit code for > Boolean expressions with simple operands, is that the branch penalties > on modern processors are so large that the short-circuit form is not > obviously faster. This may explain why the Ada compiler is not using the > short-circuit code automatically. > > Clearly, if the expression is "(simple operand likely to be True) and Oops, my brain fart: change that to "likely to be False". > (longer and longer expression)", at some point the short-circuit code > (or changing to "and then") will become faster than the long-circuit > code, whatever the branch penalty. This point will come sooner if > profile-guidance is used to reduce the branch penalty. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .