Re: Book on low level program optimization
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Mon, 30 May 2005 23:57:26 -0700
Richard E Maine wrote:
No, statement functions are not necessarily inlined. That is not an inherent property of statement functions. The standard mentions nothing on the subject.
It happens that many implementations do inline statement functions, but that is not inherent in their definition. It is just that their definition means that they are inevitably simple enough to be good candidates for inlining. Therefore, they often are inlined, but not always.
There is a story I posted not so long ago about a benchmark program that was written almost entirely with statement functions. It turned out that one compiler not only inlined statement functions but did constant expression evaluation, and so did the whole benchmark at compile time.
It seems that this was surprising at the time, so either inlining statement functions or constant expression evaluation must not have been too common.
With the ever decreasing price for memory, I would be surprised if a modern compiler didn't inline them, but in any memory constrained system
I probably wouldn't do it.
Also, there are compilers with the option to optimize for time or memory usage. That might also affect statement function inlining.
-- glen
.
- References:
- Book on low level program optimization
- From: Niels L. Ellegaard
- Re: Book on low level program optimization
- From: David Flower
- Re: Book on low level program optimization
- From: Richard E Maine
- Book on low level program optimization
- Prev by Date: Re: Nice to have feature in upcoming Fortran compilers...
- Next by Date: Re: static function ? how ?
- Previous by thread: Re: Book on low level program optimization
- Next by thread: Re: Book on low level program optimization
- Index(es):
Relevant Pages
|
|