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: 103376,2a34b7ad6c6a0774 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!j8g2000yqd.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Elias_Salom=E3o_Helou_Neto?= Newsgroups: comp.lang.ada Subject: Re: Efficiency of code generated by Ada compilers Date: Mon, 16 Aug 2010 06:45:05 -0700 (PDT) Organization: http://groups.google.com Message-ID: <6ba116c2-f922-469c-88ff-29ae3d4720de@j8g2000yqd.googlegroups.com> References: <1jn1a4o.1dfllwo1uin3imN%csampson@inetworld.net> <1jn36d6.se2f0g1edjjnyN%csampson@inetworld.net> <61f149b9-00ff-40cd-9698-01e69fdc5c0f@v15g2000yqe.googlegroups.com> <1jn7hdz.1612v6172y0thN%csampson@inetworld.net> NNTP-Posting-Host: 143.107.183.162 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1281966306 25039 127.0.0.1 (16 Aug 2010 13:45:06 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 16 Aug 2010 13:45:06 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j8g2000yqd.googlegroups.com; posting-host=143.107.183.162; posting-account=8auP9QoAAACkSx2qxJhP83KA6-tg78E8 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:13409 Date: 2010-08-16T06:45:05-07:00 List-Id: On Aug 14, 1:13=A0pm, csamp...@inetworld.net (Charles H. Sampson) wrote: > Elias Salom=E3o Helou Neto wrote: > > > ... > > > Well, we are definitely drifting away from the original question. So > > much that I am considering to give up reading answers from this > > post... > > > Anyway, someone prematurely implied that I may be doing premature > > optimization. The fact is that I do know, from profiling, how > > important is _not_ to range check in my specific application, so I > > will try to give you a "bottom line" of what have been said that > > really matters to me. > > > ... > > =A0 =A0 =A0I think I'm the guy who implied that you're doing premature > optimization, or at least the guy who you think implied that. > > =A0 =A0 =A0You appear to have a deep knowledge of your application. =A0I > certainly don't. =A0Therefore I have to defer to your judgement on the > question. =A0But I probably did raise the question that you _might be_ > prematurely worrying about optimiziing. =A0What I remember saying is that > almost every time =A0_I_ make a guess about optimization, I'm wrong. Dimitry pointed out above that the compiler could suppress the checks by itself, which would mean my optimization was unnecessary anyway. I think it was a good point indeed, but I kind of doubt that a compiler could be smart enough for doing that in my case anyway. Maybe I am just not smart enough to think of a good optimizing strategy for compilers :) And yes, I know how many times guesses about optimization are just plain and simply wrong. > =A0 =A0 =A0A number of people have given you information about optimizati= on of > a number of Ada compilers. =A0I'll give you an example of the last one I > worked with. =A0This compiler uses a not uncommon approach to code > generation. =A0It initially generates pretty mediocre code, in particular > code that contains a lot of unnecessary range checks and even > unnecessary register loads. =A0Then, if the user wants, it passes that > code through a pretty good optimizer. =A0You might say that the compiler > has two modes, development and production. > > =A0 =A0 =A0My last project was a real-time application. =A0We hit all of = our > deadlines, which is all that counts in the real-time world. =A0(We > achieved this in the crudest way: We beat it about the head and > shoulders with a very fast CPU and gobs of memory.) =A0Nonetheless, twice > during my time on the project, I compiled the whole application using > the optimizer (but not with range checks, or any checks, explicitly > suppressed). =A0The generated code improved dramatically. =A0Checks that = the > optimizer could verify weren't needed disappeared. =A0Code motion did som= e > pretty things. =A0And so on. =A0However, when I ran this much improved > version, I couldn't see any difference between it and the crude version, > including any increase in the amount of time the application was in its > idle state. =A0In short, whatever improvement there was in execution, > wasn't worth the increase in compilation time. > > =A0 =A0 =A0That's a pretty standard story, illustrating that you usally n= eed > to analyze before optimizing. =A0However, as people love to say, YMMV. > (That's twitter-speak for "This might not apply in your case.") In my case, things were somewhat different. For example, manually telling GCC to inline some functions reduced running times in about 15%. Even if I turned GCC's optimizer fully on, it was not able to automatically inline those functions. That should have been a simple matter to the optimizer, since I did not use any pointer to that function or something similar. I guess we are running into different results here because I am writing numerical software that runs very tight loops within which I have to address matrices elements in a _very_ efficient manner. > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Charlie > -- > All the world's a stage, and most > of us are desperately unrehearsed. =A0Sean O'Casey Thank you, Elias Salom=E3o Helou Neto