Potential of a compiler that creates the executable at once

Mark smarksc at gmail.com
Thu Feb 10 21:28:56 UTC 2022


On Thursday, 10 February 2022 at 11:54:59 UTC, bauss wrote:
> On Thursday, 10 February 2022 at 09:41:12 UTC, rempas wrote:
>>
>> At some point about 3 months ago, the creator of the language 
>> said that at that point, Vox can compile 1.2M LoC/S which is 
>> really really fast and this is a point that 99% of the 
>> projects will not reach so your project will always compiler 
>> in less than a second no matter what! What is even more 
>> impressive is that Vox is single thread so when parsing the 
>> files for symbols and errors, why could get a much bigger 
>> performance boost if we had multithread support!
>>
>
> You see, there's a large misconception here.
>
> Typically slow compile times aren't due to the LoC a project 
> has, but rather what happens during the compilation.
>
> Ex. template instantiation, functions executed at ctfe, 
> preprocessing, optimization etc.

If you generate an executable directly (without going through 
compilation to object files and then linking) then you can save 
some compile time on these tasks, no? For instance, you can 
maintain some sort of global cache so that repeated 
instantiations of the same template (in different compilation 
units) are detected during compilation; this then saves you time 
on compiling something that you have already compiled before. I 
assume that such repeated instantiations are very common when 
there is heavy usage of the standard library.

The same goes for identical CTFEs and any other compilation step 
that can potentially repeat in different compilation units.

Assuming link-time optimization, the end result (the executable) 
should be the same, but the compile times will be different.


More information about the Digitalmars-d mailing list