Overhead when using a C library

John Colvin john.loughran.colvin at gmail.com
Thu Mar 14 08:02:40 PDT 2013


On Thursday, 14 March 2013 at 00:52:41 UTC, Timon Gehr wrote:
> On 03/14/2013 01:48 AM, Jeremy DeHaan wrote:
>> Hey guys!
>>
>> I am working on a binding for D, and am almost finished! I 
>> started to
>> think of some things I might like to work on to improve the 
>> binding
>> after I get everything working, and one of the things I 
>> thought of was
>> rewriting certain parts to use only D code instead of making 
>> calls to
>> the C functions. Is there any kind of performance overhead in 
>> using C
>> libraries to interact with your D program? If it isn't going 
>> to offer
>> much performance gain then I probably don't need to bother 
>> writing extra
>> code.
>>
>> Thanks as usual!
>
> There is no additional overhead (though the D compiler will not 
> be able to inline C functions, whereas an identical D function 
> may be inlined.)

A decent link-time optimiser will be able to do the inlining 
where appropriate. gdc can be compiled with lto enabled, as Artur 
shows in his reply.


More information about the Digitalmars-d-learn mailing list