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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,edfa88b682578b7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-26 16:45:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.cs.utexas.edu!geraldo.cc.utexas.edu!not-for-mail From: "Bobby D. Bryant" Newsgroups: comp.lang.ada Subject: Re: Overhead for type conversions? Date: Sat, 26 Jul 2003 17:39:49 -0600 Organization: dis- Message-ID: References: NNTP-Posting-Host: dial-17-1.ots.utexas.edu Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: geraldo.cc.utexas.edu 1059262836 23519 128.83.128.33 (26 Jul 2003 23:40:36 GMT) X-Complaints-To: abuse@utexas.edu NNTP-Posting-Date: Sat, 26 Jul 2003 23:40:36 +0000 (UTC) User-Agent: Pan/0.14.0 (I'm Being Nibbled to Death by Cats!) Xref: archiver1.google.com comp.lang.ada:40854 Date: 2003-07-26T17:39:49-06:00 List-Id: On Sat, 26 Jul 2003 12:01:43 -0400, Warren W. Gay VE3WWG wrote: > "Nick Roberts" wrote in message news:bfu83g$ibodl$1@ID-25716.news.uni-berlin.de... >> "Bobby D. Bryant" wrote in message >> news:pan.2003.07.25.01.01.43.5699@mail.utexas.edu... >> >> > Given these declarations - >> > >> > type f1 is new float; >> > type f2 is new float; >> > >> > function "*"( left : in f1; right : in f2 ) return f1 is >> > begin >> > return( left * f1( right ) ); >> > end "*"; >> > > ... >> I would also suggest that a function like this should be declared inline, >> since it is likely that the eliminated call and return code would be bigger >> (as well as much slower) than the intrinsic code for the multiplication >> anyway. I actually used the inline pragma in the test program I wrote before posting, but decided to delete it from the post in order to avoid raising an issue that I thought irrelevant to the basic question. (But of course it isn't really irrelevant, since the question of inlining wouldn't be raised at all if I just used floats instead of the two derived types.) > I once suggested something like this to Simon Wright regarding > some procedure/function calls within the Booch Components. He > did some profiling, and discovered that inlining that I suggested > actually worsened the performance slightly under Linux. I don't > know if he did more investigations along this line, but for > the examples that I suggested, it actually made things worse > (due to instruction caching reasons I expect). > > So inlining should probably be tested before the conclusion is > made. [...] Yes, I have profiled some code a time or two and discovered that some "obvious" inlining didn't help, and in fact actually appeared to hurt a little in one case. So I now assert that the desirability of inlining is an empirical issue, though in fact I still make the decision heuristically more often than empirically. -- Bobby Bryant Austin, Texas