Inherent code performance advantages of D over C?

Walter Bright newshound2 at digitalmars.com
Sun Dec 8 10:46:04 PST 2013


On 12/8/2013 4:35 AM, ponce wrote:
>> 3. Function inlining has generally been shown to be of tremendous value in
>> optimization. D has access to all the source code in the program, or at least
>> as much as you're willing to show it, and can inline across modules. C cannot
>> inline functions unless they appear in the same module or in .h files. It's a
>> rare practice to push many functions into .h files. Of course, there are now
>> linkers that can do whole program optimization for C, but those are kind of
>> herculean efforts to work around that C limitation of being able to see only
>> one module at a time.
>
> This point is not entirely accurate. While the C model is generally harmful with
> inlining, with the Intel C++ compiler you can absolutely rely on cross-module
> inlining when doing global optimization. I don't know how it works, but all out
> tiny functions hidden in separate translation units get inlined.

I believe this is the linker thing I mentioned at work.



More information about the Digitalmars-d mailing list