Inline Functions
Lutger
lutger.blijdestijn at gmail.com
Tue Feb 24 12:49:08 PST 2009
Mason Green wrote:
> bearophile:
>
> Thanks for the reply.
>
>> A JavaVM like HotSpot is more refined than the backend of DMD, its GC is
much more refined and more efficient, it's much better in inlining virtual
methods, its data structures are usually better performance-tuned, etc. The
D language is newer than Java, and it has enjoyed far less money, developers
and users.>
>
> Very well put! But, do you know if there is a way to force inlining where
I want it? Someone mentioned to me that template mixins may work...? I
would rather not inline all the code by hand, as I would like to trust the
compiler.
You could use mixins, but that won't lead to pretty code. It's useful to
know which kinds of code can get inlined by dmd. I don't have much knowledge
of this, but the most common things that won't get inlined are loops,
delegates and virtual functions iirc.
>> Have you profiled your D code? What has the profiling told you? Have you
seen where you allocate memory, to move such allocations away from inner
loops, or just reduce their number? >
>
> No, I have not profiled the D code other than using an FPS counter... :-)
To be honest, I'm fairly light on experience when it comes to profiling. Do
you have any suggestions on how to make it happen?
dmd's builtin profiler can be useful. Some time ago I have written a small
utility to help make it's output more readable:
http://www.dsource.org/projects/scrapple/wiki/PtraceUtility
More information about the Digitalmars-d
mailing list