[cfe-dev] Slowness of clang build

Edward Diener eldlistmailingz at tropicsoft.com
Sat Dec 29 10:50:55 PST 2012


On 12/29/2012 12:02 PM, David Blaikie wrote:
> On Sat, Dec 29, 2012 at 8:47 AM, Edward Diener
> <eldlistmailingz at tropicsoft.com> wrote:
>> I am periodically retrieving the latest sources from the llvm/clang
>> repository, as specified in the Getting Started page.
>>
>> When I do a build of clang, through the 'make' command from the build
>> directory, the build runs very slow. Evidently the default is a Debug+Assert
>> build. Compiling a single source file averages 5-10 seconds and overall the
>> build takes hours considering how many modules must be built. It is all
>> successful in the end and when I am finished I have the latest clang, which
>> is great.
>>
>> I have plenty of memory, plenty of disk space, a fairly fast CPU, and am
>> doing the build on Fedora 17 with hardly any other applications running.
>
> Could you be more specific about the CPU, cores, and available memory?

I have 8 GB of memory and 4 CPUs.

> (have you watched the utilization while building Clang? Is the build
> topping out on RAM/using swap? using all your CPU cores?)
>
> The simplest thing to do is probably to pass "-j N" where N is the
> number of cores you have available (by default the make build isn't
> parallelized).

Use "make -j 4" ?

>
> Other ideas:
> * what compiler are you using to perform the build?

I just execute 'make' from my buid directory. I have no idea what 
compiler clang uses. Is there a way to find out ? I would expect it uses 
'clang' itself.

> If it's a previous
> Debug+Asserts build of Clang, then that's really going to slow things
> down - don't use that, use Release+Asserts or Release-Asserts.

How do I specify Release+Asserts in the 'make' command line ?

> * you could try the cmake+ninja build (ninja will run maximally
> parallel by default & exploits more parallelism than the make build)

Again I am just following clang's own instructions in their getting 
started page. I have not tried cmake.

> * to do a release build of clang (which might speed things up a little
> since you won't be dealing with debug info, etc) I think it's
> "--disable-optimized" when configuring the make based build

Is this a configure option ? Do I go back and rerun ./configure passing 
it '--disable-optimized' ?





More information about the cfe-dev mailing list