From: "Bobby D. Bryant" <bdbryant@mail.utexas.edu>
Subject: Re: Overhead for type conversions?
Date: Sat, 26 Jul 2003 17:39:49 -0600
Date: 2003-07-26T17:39:49-06:00 [thread overview]
Message-ID: <pan.2003.07.26.23.39.45.556296@mail.utexas.edu> (raw)
In-Reply-To: SGxUa.389$XK4.17275@read1.cgocable.net
On Sat, 26 Jul 2003 12:01:43 -0400, Warren W. Gay VE3WWG wrote:
> "Nick Roberts" <nickroberts@blueyonder.co.uk> wrote in message news:bfu83g$ibodl$1@ID-25716.news.uni-berlin.de...
>> "Bobby D. Bryant" <bdbryant@mail.utexas.edu> 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
next prev parent reply other threads:[~2003-07-26 23:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-25 1:01 Overhead for type conversions? Bobby D. Bryant
2003-07-25 2:36 ` Robert I. Eachus
2003-07-25 7:12 ` Bobby D. Bryant
2003-07-25 15:34 ` Matthew Heaney
2003-07-25 18:28 ` Randy Brukardt
2003-07-26 15:54 ` Nick Roberts
2003-07-26 16:01 ` Warren W. Gay VE3WWG
2003-07-26 23:39 ` Bobby D. Bryant [this message]
2003-07-27 13:41 ` Loop Optimisation [was: Overhead for type conversions?] Nick Roberts
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox