DI Generation Needs your Help!
Alvaro
alvaroDotSegura at gmail.com
Wed Mar 14 14:42:54 PDT 2012
El 14/03/2012 22:13, Adam Wilson escribió:
> On Wed, 14 Mar 2012 13:45:13 -0700, Alvaro <alvaroDotSegura at gmail.com>
> wrote:
>
> The problem is that in DI generation, at least as near as I can tell, D
> has now idea how big a function is during DI generation. In my
> experience it was keeping all functions not just small ones. And frankly
> DI generation is targeted at library builders who are well aware of the
> inlining trade-offs. And then comes the question of how do you define
> "small functions" to an adequately technical level.>
OK, I rechecked. DMD -H is at least omitting function bodies containing
foreach() loops (and maybe other cases). Maybe that led me to assume things.
AFAIK some C++ compilers use heuristics (don't really know what that is
exactly) to decide what "small functions" deserved automatic inlining.
And well, C++ library builders are aware of that and usually keep the
small functions they want inlined in the header file (e.g. in the class
declaration). I can see a lot of cases where D libraries would benefit
from allowing some of their functions to be inlined. Think of
@properties, they're often pretty short.
Other than this detail, the improvement in DI generation is very welcome.
More information about the Digitalmars-d
mailing list