[cfe-dev] clang-cl.exe (32bit) dog slow, capping at ~16.5% CPU

Hahnfeld, Jonas via cfe-dev cfe-dev at lists.llvm.org
Thu Jun 1 02:32:04 PDT 2017


If you only need debug _information_, you may try RelWithDebInfo.

 

AFAIK Clang calls into the LLVM libraries. So if you compile those in debug mode, Clang will still be slow even if compiled as Release.

 

Cheers,

Jonas

 

From: Nikodemus Siivola [mailto:nikodemus at random-state.net] 
Sent: Thursday, June 1, 2017 11:28 AM
To: Hahnfeld, Jonas <Hahnfeld at itc.rwth-aachen.de>
Cc: cfe-dev at lists.llvm.org
Subject: Re: [cfe-dev] clang-cl.exe (32bit) dog slow, capping at ~16.5% CPU

 

Is there a way to build LLVM libraries with debug info and clang with release flags?

(I'm working on a frontend toy and figuring out what I've done to to crash LLVM is much easier with a debug build...)

 

 

On Thu, Jun 1, 2017 at 10:47 AM, Hahnfeld, Jonas <Hahnfeld at itc.rwth-aachen.de <mailto:Hahnfeld at itc.rwth-aachen.de> > wrote:

> cmake -G "MinGW Makefiles" \

  -DCMAKE_INSTALL_PREFIX=C:\LLVM \

  -DCMAKE_BUILD_TYPE=Debug \

  -DLLVM_ENABLE_ASSERTIONS=On \

  -DLLVM_TARGETS_TO_BUILD=X86 \

  -DLLVM_ENABLE_CXX1Y=On \

  ../

 

CMAKE_BUILD_TYPE=Debug will result in a non-optimized compiler. Although I don’t have numbers at hand, you might want to set CMAKE_BUILD_TYPE=Release.

 

Regards,

Jonas

 

From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org <mailto:cfe-dev-bounces at lists.llvm.org> ] On Behalf Of Nikodemus Siivola via cfe-dev
Sent: Thursday, June 1, 2017 9:43 AM
To: cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org> 
Subject: [cfe-dev] clang-cl.exe (32bit) dog slow, capping at ~16.5% CPU

 

I was wondering why compiles were so slow and noticed that clang-cl.exe is never consuming more than ~16.5% CPU on my laptop. This is an i7-7700HQ, 32GB memory, running Windows 10 Pro.

 

Memory and disk use appear trivial as well, and the computer was otherwise mostly idle at the time. 

 

Compiling a trivial hello-world takes 11 seconds:

 

$ clang --version

clang version 4.0.1

Target: i686-pc-windows-msvc

Thread model: posix

InstalledDir: C:\LLVM\bin

 

$ cat foo.cpp

#include <iostream>

 

int main()

{

    std::cout << "Yo" << std::endl;

    return 0;

}

 

$ time clang-cl foo.cpp

 

real    0m11.886s

user    0m0.015s

sys     0m0.015s

 

Compiling the same program under the Linux subsystem and clang-3.5 takes 0.16seconds. The Visual Studio commandline compiler is likewise almost instant.

 

This is release_40 from one of the git mirrors, build built as part of the LLVM tree using Visual Studio 2015 command prompt, with (I think, not 100% sure, don't know cmake well enough to figure out after the fact) the following cmake invovations:

 

cmake -G "MinGW Makefiles" \

  -DCMAKE_INSTALL_PREFIX=C:\LLVM \

  -DCMAKE_BUILD_TYPE=Debug \

  -DLLVM_ENABLE_ASSERTIONS=On \

  -DLLVM_TARGETS_TO_BUILD=X86 \

  -DLLVM_ENABLE_CXX1Y=On \

  ../

cmake --build .

 

Did I pick spectacularly stupid build options or something?


Any suggestions for figuring out what is going on? (Windows is not my regular platform so I'm a bit out of depth here.)

Cheers,

 

 -- nikodemus

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170601/8e75fef5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170601/8e75fef5/attachment.bin>


More information about the cfe-dev mailing list