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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c8acfc87fbb1813d X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!s36g2000prf.googlegroups.com!not-for-mail From: deadlyhead Newsgroups: comp.lang.ada Subject: Re: Timing code blocks Date: Fri, 5 Mar 2010 00:16:52 -0800 (PST) Organization: http://groups.google.com Message-ID: <12e4d91f-9c23-49fb-a413-97c0375a1668@s36g2000prf.googlegroups.com> References: <2d5bead9-72f9-4c84-9ac1-a058c2591ef1@c37g2000prb.googlegroups.com> <13j6juslcud2k.1n4jnpj74p3k$.dlg@40tude.net> NNTP-Posting-Host: 216.57.220.9 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1267777013 11118 127.0.0.1 (5 Mar 2010 08:16:53 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 5 Mar 2010 08:16:53 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s36g2000prf.googlegroups.com; posting-host=216.57.220.9; posting-account=snJuNwoAAABnc8T9lYkBlDQrDdSjOjG2 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:9415 Date: 2010-03-05T00:16:52-08:00 List-Id: On Mar 4, 11:55=A0pm, "Dmitry A. Kazakov" wrote: > > This is an ancient bug, which managed to survive a number of GNAT compile= r > versions. > > As a workaround, add delay 0.0 at the beginning of your program: > > > ---------------------------------------------------------------------- > > > -- =A0A test of the cost of conditionals > > > with Ada.Text_IO; =A0use Ada.Text_IO; > > with Ada.Real_Time; use Ada.Real_Time; > > procedure Conditional_Test is > Exactly what was needed. Thank you! Do you happen to know if this bug has been fixed in the current development branch? (At home I compile GNAT based on GCC 4.4, but haven't done any real-time tests with it yet.) This seems like an unfortunate bug to have lying around in an otherwise respected compiler. The ease of the workaround, and likewise that it seems so pointless to have to insert a dummy delay statement, would lead many to believe that this bug was just a sloppy error, even if the real reasons it exists are somewhat more complex. BTW, my test results with -O3 and -Os, there is no difference in performance between the two loops, and -Os produces code that is about 33% faster than -O3. With -O0, the second loop is faster by an average of 10%. I would have thought the extra conditional would have been costlier. Again, thanks for the reply! -- deadlyhead