[More Info] Increasing speed of D applications to Intel C compiled applicaitons' standards
Dave
Dave_member at pathlink.com
Sat Nov 11 14:51:56 PST 2006
Dave wrote:
> Sean Kelly wrote:
>> Dave wrote:
>>>
>>> Could it be that Intel is doing whole program optimization to inline
>>> things like memcpy and memset, during linkage (Are you using WPO? --
>>> it may be the default, I can't remember)? I've found that for time
>>> critical code I can code my own (e.g.: memset) in D so the compiler
>>> can inline it and it will be faster. Perhaps those should be in
>>> Phobos instead of the C lib.?
>>
>> I've been thinking about this as well. These functions are possibly a
>> bit much for intrinsics, but it would be fairly trivial to write them
>> in native D or even assembler--would have to inspect the resulting
>> compiled code to see which was better. The only problem offhand is
>> that DMD does not inline functions containing loops, nor does it
>> inline functions containing ASM blocks, so we'd probably be stuck with
>> a function call even with native D code.
>>
>
> Good points - I'd forgotten about not inlining loops.. The way I've
> "inlined" things like memset() is to just write a foreach if needed.
>
BTW - Since performance has come up a lot lately.. The reason one has to write the loop to get the
most out of a simple memset type operation is because things like arr[100..200] = 0; are replaced by
a call to memset anyhow. This is something that the compiler really should treat like an intrinsic IMO.
>> Sean
More information about the Digitalmars-d
mailing list