Speed up compilation in Visual D

Alex AJ at gmail.com
Fri Apr 26 04:50:52 UTC 2019


On Wednesday, 24 April 2019 at 05:34:10 UTC, Rainer Schuetze 
wrote:
>
>
> On 23/04/2019 18:03, Alex wrote:
>> On Tuesday, 23 April 2019 at 07:03:36 UTC, Rainer Schuetze 
>> wrote:
>>>
>>>
>>> On 23/04/2019 02:50, Alex wrote:
>>>> Is there any way to speed of compilation in Visual D? Seems 
>>>> everything is being recompiled from scratch even with minute 
>>>> changes. I'd think compiling to object files might help but 
>>>> maybe not?
>>>
>>> With visualdproj project files, you can select between 
>>> building all at once (which would cause what you describe 
>>> unless you separate your code into multiple libraries) and 
>>> single file compilation which will only recompile what 
>>> (transitively) imports the file with the changes, but that's 
>>> often only faster if there are only few files to update.
>> 
>> How do I enable this? There are probably 10 thousand files and 
>> I updating just a few.
>> 
>> I tried some of the different compilation options[combined 
>> compile and link and separate compile and link] and they all 
>> took about the same time except with separate compile I'd get 
>> the warning:
>> 
>> x64\Debug DMD\_.obj : warning LNK4042: object specified more 
>> than once; extras ignored
>> 
>> x4
>
> I guess you have multiple file _.d in different directories? 
> You should enable "keep path from source" on the output page so 
> these are not written to the same object files.
>
> "combined" and "separate" compile and link only have subtle 
> differences that won't have an effect on large projects. 
> "combined" will try to let dmd also do the link in the same 
> invocation, but that is often prohibited by other options.
>
> You might want to try "single file compilation" with "keep path 
> from source" instead.
>
When I try single file compilation I get errors about models not 
being found. the problem doesn't exist in combined compilation.

I think, but not sure, it's because I have some files in 
different directories that access files across "realms".

So I'm having to add include's for all these directories just to 
get things to compile ;/

Since I use a hierarchy of folders, this is a real pain in the 
ass ;/ D doesn't seem to let one recursively search included 
subdirectories for the includes ;/

It wants a flat list of files to work well, it seems, which is 
asinine given that it is very hard to maintain projects that way.

Why it works on combined compile I don't know. The build log is 
vastly different and seems to be figuring out the import paths 
and doing something with rsp files.

I won't be able to use single file compilation the way it is 
working since I'd have to include about 100 directories ;/

....

Ok, so I went ahead and did it, it wasn't 100 but about 20. The 
copy full path came in handy.

Now I get a compiler crash!

It seems because it is due to the fact that I have some code that 
reads modules and imports their text, which requires a -J for 
every directory, and I have to add it for every new file path I 
end up using(One thing I hate D about because it forces me to 
keep track of all this mess rather than just working).

The thing is, I have all the proper -J's under command line. But 
they are not showing up on the command line but they are when I 
do combined compile.

So possibly this is a bug in Visual D where single compile mode 
is ignoring the additional command line options?

As if when generating the command line for single file 
compilation you forgot to append the additional options string to 
it.




May I make a suggestion?


Allow visual D to automatically generate paths for the command 
line by using wild cards.

This might require a special input box like

-J [                         ] [+]

Where one can then add paths like one can do with imports, 
versions, etc

but one can use wild cards like

C:\Project\*;C:\WaltersSecureInfoToHack\*

and visual D will parse all the sub directories and add them 
manually.

This will alleviate some major headaches with D's security but it 
should be valid since it's used inside an IDE. (since no one 
passes around visual D project files anyways.

The same could be done for import paths too.

It would simply allow me to use one import such as C:\Projects\*. 
Since all ones I added are hard coded, if I ever move things 
around I have to modify all the paths(and remember to do so).


Thanks.




More information about the Digitalmars-d-ide mailing list