[cfe-users] Clang 3.9 running 50% slower than 3.7

David Blaikie via cfe-users cfe-users at lists.llvm.org
Thu Mar 17 08:26:54 PDT 2016


On Wed, Mar 16, 2016 at 3:36 PM, jpsota at gmail.com <jpsota at gmail.com> wrote:

>
>
> On Wed, Mar 16, 2016 at 5:55 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>>
>>
>> On Wed, Mar 16, 2016 at 2:12 PM, jpsota at gmail.com <jpsota at gmail.com>
>> wrote:
>>
>>> David and all, a couple more questions.  I stumbled upon
>>> http://llvm.org/docs/Packaging.html and see a few other options. For a
>>> typical clang build where I am not hacking on clang, but I do want good
>>> error messages for debugging my programs,
>>>
>>
>> Define "my programs" - are you using LLVM as a library? If so, you
>> probably want a with-asserts build for development so you get better
>> failures when you use LLVM incorrectly. If you're just using Clang as a
>> normal compiler - a build without assertions should be just fine. If you
>> hit a crash in the compiler you can still file it, and we'll run in with an
>> assertions-enabled build to investigate further, generally.
>>
>
> Just using clang (and clang tools) -- not using LLVM as a library. So,
> running without assertions seems right for my needs.
>
>
>>
>>
>>> which options are recommended [1]? It seems like I should use
>>> --disable-assertions, but I'm not sure about enable-debug-symbols and
>>> enable-optimized (which seem at odds with each other?).
>>>
>>
>> If you're using LLVM as a library, but not expecting to be able to fix
>> any bugs in it yourself, probably optimized with assertiotns and without
>> debug info should be fine.
>>
>> If you're just using clang as a compiler, release (optimized), no
>> assertions, no debug info.
>>
>>
>
> It seems that just enabling -DCMAKE_BUILD_TYPE=Release is not sufficient
> to turn off assertions as I tried that and when I run clang-tidy --version
> it says " LLVM version 3.9.0svn; Optimized build with assertions." So, I'm
> going to try --disable-assertions --enable-optimized --disable-debug-symbols
> (or the environment variable equivalents).
>
> That seem right to you?
>

Yeah, sounds about right.


> It's still confusing to me that there's no CMAKE_BUILD_TYPE that enables
> these sorts of options as a bundle, but I guess that's what I get from
> compiling from source.
>

Yeah - not sure what the right recipe is for building things the same as
the official releases. No doubt it's written down somewhere...


>
> Thanks
> Jim
>
>
>
>
>> [1]
>>
>>> --disable-assertions--enable-debug-symbols--enable-optimized
>>> [2]
>>>
>>> $ clang --version
>>>
>>> clang version 3.9.0 (trunk 263648)
>>>
>>> Target: x86_64-apple-darwin15.0.0
>>>
>>> Thread model: posix
>>>
>>> InstalledDir: /Users/jim/toolchains/llvm/bin
>>>
>>> On Wed, Mar 16, 2016 at 2:05 PM, jpsota at gmail.com <jpsota at gmail.com>
>>> wrote:
>>>
>>>> Got it -- thanks!
>>>>
>>>>
>>>> On Wednesday, March 16, 2016, David Blaikie <dblaikie at gmail.com> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Wed, Mar 16, 2016 at 7:25 AM, jpsota at gmail.com via cfe-users <
>>>>> cfe-users at lists.llvm.org> wrote:
>>>>>
>>>>>> Hi, I recently installed "Release" clang (svn r263305) from source on
>>>>>> my OSX machine, and it's compiling a 20 file C++ program about 50% slower
>>>>>> than the natively installed clang 3.7 (that came with xcode, I believe,
>>>>>> although I don't use xcode). I currently have both sets of tools installed
>>>>>> and am able to switch back and forth and verify using time that clang 3.7
>>>>>> takes about 30 seconds and clang 3.9 takes about 45 seconds, on average
>>>>>> (all flags, settings, etc. are the same for both). I did build with
>>>>>> "Release" as the build type, although I also did set
>>>>>> DLLVM_ENABLE_ASSERTIONS=ON (could this be the problem?).
>>>>>>
>>>>>
>>>>> Yes, the build system should print a warning telling you that an
>>>>> assertions enabled build can be up to ten times slower. Performance
>>>>> comparisons/measurements of an assertions enabled compiler aren't something
>>>>> we really do/tune for.
>>>>>
>>>>>
>>>>>> More details below. Please let me know if you have any ideas about
>>>>>> why this newer clang would be noticable slower.
>>>>>>
>>>>>> Generally, I'm just trying to use clang as a user, not a clang
>>>>>> developer, so if you have general recommendations for how to configure
>>>>>> this, please let me know.
>>>>>>
>>>>>> Thank you,
>>>>>> Jim
>>>>>>
>>>>>> How I configured and installed:
>>>>>>
>>>>>> cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
>>>>>> -DLLVM_ENABLE_ASSERTIONS=ON ../llvm
>>>>>> make
>>>>>> cmake -DCMAKE_INSTALL_PREFIX=$CLANG_PREFIX -P cmake_install.cmake
>>>>>>
>>>>>>
>>>>>> Here are some specifics:
>>>>>>
>>>>>> $ uname -a
>>>>>> Darwin localhost 15.0.0 Darwin Kernel Version 15.0.0: Wed Aug 26
>>>>>> 16:57:32 PDT 2015; root:xnu-3247.1.106~1/RELEASE_X86_64 x86_64
>>>>>>
>>>>>> $ clang --version
>>>>>> clang version 3.9.0 (trunk 263305)
>>>>>> Target: x86_64-apple-darwin15.0.0
>>>>>> Thread model: posix
>>>>>> InstalledDir: /Users/jim/toolchains/llvm/bin
>>>>>>
>>>>>> _______________________________________________
>>>>>> cfe-users mailing list
>>>>>> cfe-users at lists.llvm.org
>>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>>>>>>
>>>>>>
>>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20160317/64c66721/attachment.html>


More information about the cfe-users mailing list