tags:

views:

245

answers:

3

I'm trying to improve the D front-end for GCC(GDC).

I just got the d front-end compiling with GCC-4.3.1. But it took an awful long time compared to build it when I used GCC-4.1.2. This is the version of gdc:

Using built-in specs.

Target: i686-pc-linux-gnu

Configured with: ../configure --enable-languages=d --prefix=/usr/local/gdc --enable-static --disable-shared

Thread model: posix

gcc version 4.3.1 (GCC)

I would say that it took close to 30 minutes to build, but when using 4.1.2, it took around 10 minutes. How can I decrease the time it takes? All I am going to do is make changes to what is inside the D folder, nothing else.

A: 

Use make -j4 or higher, depending on your number of CPU cores.

LiraNuna
Well, it's a single core CPU, so would that still do anything to help build times?
It can because compilers spend a lot of time blocking on IO. So while one thread is waiting to write an object file, another thread can be compiling.
Baxissimo
+1  A: 

If you're going to make changes only in one folder out of many, the build system of GCC (based on GNU make) will only recompile the files that depend on your change. So, it's only first build that lasts long time. Usually it takes less than 5 minutes to rebuild gcc after a file change.

Another thing that may help is using -j option. It makes make run several compilations at once, where possible. The standard advice is to set it to number of cores + 1. In your case that would be -j2. That obviously doubles RAM usage, so watch it out!

Other than that you'll hardly find any help. Some parts of gcc are used for different languages, so you're likely to build considerable part of gcc even if you only wat one language.

Pavel Shved
A: 

Okay, so I'll use -j2 from now on.

I think part of the problem was that after I had built GCC once, I would reconfigure it if I changed something inside the D folder, so build times were a lot bigger than if I just ran make again, and let it figure out what I changed.

Now the build times are bearable. :)

Michael P.
You've asked the question with user ID 169144 but this "answer" (which isn't) was replied with user ID 169389. You should use a consistent user ID. See http://meta.stackoverflow.com/questions/18232 for help with merging accounts.
ephemient