How to accelerate the linking time?

Steven Schveighoffer schveiguy at gmail.com
Sat Jul 11 00:36:47 UTC 2020


On 7/10/20 8:17 PM, Arun Chandrasekaran wrote:
> On Friday, 10 July 2020 at 12:15:56 UTC, Steven Schveighoffer wrote:
>> On 7/10/20 1:45 AM, zoujiaqing wrote:
>>> [...]
>>
>> The linking time is high because of the symbol count/sizes generally. 
>> Lots of templates means the linker takes a while to sort through the 
>> mess you made ;)
>>
> 
> Mike Franklin optimized the mangling a while ago. That was a crucial 
> change, IMO (imagine how big the original was!).

Did you mean Rainer's change to use backreferences? That was for 
exponential symbols for Voldemort types with a lot of repetitive pieces. 
It's still quite possible to get large symbols if you wrap a ton of 
unrelated templates together (vibe.d and probably Hunt have quite a bit 
of templates that wrap each other).

Apologies if Mike did something else, I don't recall what that is.

There was a recent check of the basic hello world, and the number of 
symbols generated by format was alarming.

> 
> Any idea why the unnecessary symbols gets generated by the compiler 
> (foreach, etc) in release mode? I can understand for debug builds though...

I don't know if anyone's actually done any research on what is 
"unnecessary". If there are a lot of unnecessary symbols in the 
binaries, it would be good to know where they are coming from, and how 
we can possibly remove them.

This area of D development (binary object symbols) is not very sexy, so 
I don't imagine many people want to dive into it.

-Steve


More information about the Digitalmars-d mailing list