Optimisation possibilities: current, future and enhancements
kinke via Digitalmars-d
digitalmars-d at puremagic.com
Thu Aug 25 11:46:14 PDT 2016
On Thursday, 25 August 2016 at 18:09:14 UTC, Cecil Ward wrote:
> On Thursday, 25 August 2016 at 18:07:14 UTC, Cecil Ward wrote:
>> On Thursday, 25 August 2016 at 17:22:27 UTC, kinke wrote:
>>> [...]
>>
>> I think that here the optimisation is only because LDC can
>> “see” the text of the method. When expansion is not possible,
>> that would be the real test.
>
> (Assuming LDC behaves like GDC. I'm unfamiliar with LDC, I'm
> ashamed to admit.)
You're right. The question is whether it pays off to optimize
heavily for externals. If you build all modules of a binary at
once via `ldmd2 m1.d m2.d ...` or via `ldc2 -singleobj m1.d m2.d
...`, LDC emits all the code into a single LLVM module, which can
then be optimized very aggressively. So call graphs inside the
binary are taken care of, so if it's a well encapsulated library
with few (or expensive) calls to externals, it doesn't matter
much.
druntime and Phobos are treated as externals. But Johan Engelen
already pointed out that LDC could ship with them as LLVM bitcode
libraries and then link them in before machine code generation...
More information about the Digitalmars-d
mailing list