slow compilation speed

Steven Schveighoffer schveiguy at yahoo.com
Thu Jul 8 04:13:56 PDT 2010


On Fri, 02 Jul 2010 21:15:06 -0400, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> Steven Schveighoffer wrote:
>> I don't really understand what is consuming the cycles to compile, but  
>> I do note that the resulting binary (that just does unit tests on  
>> dcollections) is 10MB.
>
> Try generating a .map file and look and see what is in the executable.

I did.  There are 67,000 lines in that file.  I'm not sure what I'm  
supposed to be looking for...

I ran it with -v, and I found that the part that takes the most time is  
something that prints "function ..." continuously (replacing ... with lots  
of different functions)

The link step is not fast either (it takes a good 10-15 seconds), but I  
guess that's to be expected, see below...

I did see some symbols that were outrageously long like:

_D892TypeInfo_S3std8typecons860__T5TupleTS12dcollections4Hash387__T4HashTS12dcollections7HashMap16__T7HashMapTiTkZ7HashMap7elementS126_D12dcollections7HashMap16__T7HashMapTiTkZ7HashMap13_hashFunctionFKS12dcollections7HashMap16__T7HashMapTiTkZ7HashMap7elementZkS186_D12dcollections7HashMap16__T7HashMapTiTkZ7HashMap15_updateFunctionFKS12dcollections7HashMap16__T7HashMapTiTkZ7HashMap7elementKS12dcollections7HashMap16__T7HashMapTiTkZ7HashMap7elementZvZ4Hash8positionTS12dcollections4Hash387__T4HashTS12dcollections7HashMap16__T7HashMapTiTkZ7HashMap7elementS126_D12dcollections7HashMap16__T7HashMapTiTkZ7HashMap13_hashFunctionFKS12dcollections7HashMap16__T7HashMapTiTkZ7HashMap7elementZkS186_D12dcollections7HashMap16__T7HashMapTiTkZ7HashMap15_updateFunctionFKS12dcollections7HashMap16__T7HashMapTiTkZ7HashMap7elementKS12dcollections7HashMap16__T7HashMapTiTkZ7HashMap7elementZvZ4Hash8positionZ5Tuple6__initZ

Yeah, that's 955 characters long :)

With template abilities, and all symbols containing their module names,  
this gets to be ridiculously long.

I wonder, can symbol names be encoded with some sort of definition?  That  
is, through some special character sequence, the symbol defines a  
frequently used term in the symbol (like 'dcollections' in my example) and  
associates it with a special 1-2 character abbreviation, and then uses the  
abbreviation throughout instead of the fully-expanded name?  It will be  
less readable without demangling, but I think even with demangling, the  
symbol above will be unreadable.  All we need to come up with is standard  
rules of when to encode names (so different compilers generate the same  
symbols).

-Steve


More information about the Digitalmars-d mailing list