<div dir="ltr">Thanks, guys. I checked out tags/RELEASE_380/final and compiled that in Release mode with assertions off, and verified that the resulting binaries were "optimized" (see clang-tidy output below). Still runs about 33% slower. But, I'm going to chalk this up to a older and probably stripped down version of clang that I have on my system; this may not be an apples-to-apples comparison. I do want the customizability that I get from compiling from source, so I'm going to stick with this.<div><br></div><div>Thanks again,</div><div>Jim<br><div><br></div><div>







<p class=""><span class="">$</span><span class=""> clang-tidy --version</span></p>
<p class=""><span class="">LLVM (<a href="http://llvm.org/">http://llvm.org/</a>):</span></p><p class="">LLVM version 3.8.0</p>
<p class=""><span class="">  Optimized build.</span></p>
<p class=""><span class="">  Built Mar 25 2016 (18:53:39).</span></p>
<p class=""><span class="">  Default target: x86_64-apple-darwin15.0.0</span></p>
<p class=""><span class="">  Host CPU: westmere</span></p></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 23, 2016 at 12:19 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yeah, not sure, sorry - I don't often do performance measurements of Clang.<br><br>Don's advice is probably about right.</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 23, 2016 at 5:29 AM, <a href="mailto:jpsota@gmail.com" target="_blank">jpsota@gmail.com</a> <span dir="ltr"><<a href="mailto:jpsota@gmail.com" target="_blank">jpsota@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Don and David, just wanted to see if you guys had any quick thoughts on any of this before I just resign to live with a 35% slower clang than I'm used to (it's possible that the previous version from Xcode is much slimmed down or otherwise very carefully tuned in some way). <div><br></div><div>Thank you,</div><div>Jim</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 18, 2016 at 9:42 AM, <a href="mailto:jpsota@gmail.com" target="_blank">jpsota@gmail.com</a> <span dir="ltr"><<a href="mailto:jpsota@gmail.com" target="_blank">jpsota@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">David and Don, thanks for your tips. We're making progress as the new clang is only about 35% slower instead of 50% slower, but not quite at parity yet. Here's what I did:<div><br></div><div>1. deleted everything and started over, as Don suggested (I just checked out the source code from scratch again)</div><div><br></div><div>2. configured with cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=OFF ../llvm </div><div><br></div><div>3. built</div><div><br></div><div>Now I'm seeing that clang-tidy --verbose correctly says this new version doesn't have assertions enabled, and is optimized (for some reason clang-tidy shows more details than clang when passing --verbose):</div><div><br></div><div><div>clang-tidy --version</div><div>LLVM (<a href="http://llvm.org/" target="_blank">http://llvm.org/</a>):</div><div>  LLVM version 3.9.0svn</div><div>  Optimized build.</div><div>  Built Mar 17 2016 (16:05:27).</div><div>  Default target: x86_64-apple-darwin15.0.0</div><div>  Host CPU: westmere</div></div><div><br></div><div>However, when doing my benchmarking with the xcode version of clang (3.7), it's still about 35% faster than my newly compiled version:</div><div><br></div><div><div><div>Benchmarking compiling about 20 C++ files:</div><div>Original from xcode (3.7): 27s</div><div><br></div><div>New from svn (3.9): 37s</div></div></div><div><br></div><div><br></div><div>I also noticed that the new clang binary is significantly larger than the original one. I'm sharing this as it may provide some clues to what's going on. I'm happy to grep for symbols if that would also be helpful.</div><div><br></div><div><div>ORIGINAL FROM XCODE (3.7):</div><div>ls -ltah /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang</div><div>-rwxr-xr-x  1 root  wheel    42M Sep 22 19:25 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang</div><div><br></div><div>NEW FROM SVN (3.9):</div><div>ls -ltah /Users/jim/toolchains/llvm/bin/clang-3.9 </div><div>-rwxr-xr-x  1 jim  staff    54M Mar 17 17:00 /Users/jim/toolchains/llvm/bin/clang-3.9</div><div><br></div><div><br></div><div>Anyone have any ideas on anything else to try to get my newly compiled clang-3.9 as fast as my system-installed clang-3.7? Are there additional options I should be passing to configure the cmake files, other than Release and turning off LLVM assertions?</div><div><br></div><div>Thanks very much.</div><div><br></div><div>Jim</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 17, 2016 at 12:19 PM, don hinton <span dir="ltr"><<a href="mailto:hintonda@gmail.com" target="_blank">hintonda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">It looks like you are rerunning cmake without first removing the cache, CMakeCache.txt.  Since the option () command that sets LLVM_ENABLE_ASSERTIONS didn't include FORCE, the previous cached value is preserved.</p>
<p dir="ltr">Therefore, I'd recommend always removing the cache -- I actually blow away the entire directory tree -- and starting from scratch.</p>
<p dir="ltr">To ensure (re)builds don't take too long, I also use ccache.  Although it works great for llvm, clang, etc..., it does break the libcxx and libcxxabi tests under check-all, but I've submitted a couple trivial patches that fix that problem.</p>
<p dir="ltr">hth...<span><font color="#888888"><br>
don</font></span></p><div><div>
<div class="gmail_quote">On Mar 17, 2016 11:26 AM, "David Blaikie via cfe-users" <<a href="mailto:cfe-users@lists.llvm.org" target="_blank">cfe-users@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 16, 2016 at 3:36 PM, <a href="mailto:jpsota@gmail.com" target="_blank">jpsota@gmail.com</a> <span dir="ltr"><<a href="mailto:jpsota@gmail.com" target="_blank">jpsota@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Wed, Mar 16, 2016 at 5:55 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Wed, Mar 16, 2016 at 2:12 PM, <a href="mailto:jpsota@gmail.com" target="_blank">jpsota@gmail.com</a> <span dir="ltr"><<a href="mailto:jpsota@gmail.com" target="_blank">jpsota@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">David and all, a couple more questions.  I stumbled upon <a href="http://llvm.org/docs/Packaging.html" target="_blank">http://llvm.org/docs/Packaging.html</a> 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, </div></blockquote><div><br></div></span><div>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.</div><span><div></div></span></div></div></div></blockquote><div><br></div></span><div>Just using clang (and clang tools) -- not using LLVM as a library. So, running without assertions seems right for my needs.</div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">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?).</div></blockquote><div><br></div></span><div>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.<br><br>If you're just using clang as a compiler, release (optimized), no assertions, no debug info.</div><span><div> </div></span></div></div></div></blockquote><div><br></div></span><div>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 <span style="color:rgb(0,0,0);font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:13.3px;line-height:21px">--disable-assertions </span><span style="color:rgb(0,0,0);font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:13.3px;line-height:21px">--enable-optimized </span><span style="color:rgb(0,0,0);font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:13.3px;line-height:21px">--disable-debug-symbols </span><span style="color:rgb(0,0,0);font-size:13.3px;line-height:21px"><font face="arial, helvetica, sans-serif">(or the environment variable equivalents).</font></span></div><div><span style="color:rgb(0,0,0);font-size:13.3px;line-height:21px"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="color:rgb(0,0,0);font-size:13.3px;line-height:21px"><font face="arial, helvetica, sans-serif">That seem right to you?</font></span></div></div></div></div></blockquote><div><br></div><div>Yeah, sounds about right.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><span style="color:rgb(0,0,0);font-size:13.3px;line-height:21px"><font face="arial, helvetica, sans-serif"> 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. </font></span></div></div></div></div></blockquote><div><br></div><div>Yeah - not sure what the right recipe is for building things the same as the official releases. No doubt it's written down somewhere... </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><span style="color:rgb(0,0,0);font-size:13.3px;line-height:21px"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="color:rgb(0,0,0);font-size:13.3px;line-height:21px"><font face="arial, helvetica, sans-serif">Thanks</font></span></div><div><div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:13.3px;line-height:21px">Jim</span></font></div>







<div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><div><span style="font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.95em;color:rgb(0,0,0);line-height:21px">[1] </span></div></span><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><dt style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px"><tt style="font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.95em"><span>--disable-assertions</span></tt></dt><dt style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px"><span style="font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.95em">--enable-debug-symbols</span></dt><dt style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px"><tt style="font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.95em"><span>--enable-optimized</span></tt></dt><dt style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px"><tt style="font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.95em"><span><br></span></tt></dt><dt style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px"><tt style="font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.95em"><span>[2]</span></tt></dt><dt style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px"><tt style="font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.95em"><span>







<p><span>$ clang --version</span></p>
<p><span>clang version 3.9.0 (trunk 263648)</span></p><span>
<p><span>Target: x86_64-apple-darwin15.0.0</span></p>
<p><span>Thread model: posix</span></p>
<p><span>InstalledDir: /Users/jim/toolchains/llvm/bin</span></p></span></span></tt></dt></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 16, 2016 at 2:05 PM, <a href="mailto:jpsota@gmail.com" target="_blank">jpsota@gmail.com</a> <span dir="ltr"><<a href="mailto:jpsota@gmail.com" target="_blank">jpsota@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Got it -- thanks!<div><div><span></span><br><br>On Wednesday, March 16, 2016, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 16, 2016 at 7:25 AM, <a>jpsota@gmail.com</a> via cfe-users <span dir="ltr"><<a>cfe-users@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>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?). </div></div></blockquote><div><br></div><div>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.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>More details below. Please let me know if you have any ideas about why this newer clang would be noticable slower.</div><div><br></div><div>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.</div><div><br></div><div>Thank you,</div><div>Jim</div><div><br></div><div>How I configured and installed:</div><div><br></div><div>cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON ../llvm </div><div>make</div><div>cmake -DCMAKE_INSTALL_PREFIX=$CLANG_PREFIX -P cmake_install.cmake</div><div><br></div><div><br></div><div>Here are some specifics:</div><div><br></div><div>$ uname -a</div><div>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</div><div><br></div><div>$ clang --version</div><div>clang version 3.9.0 (trunk 263305)</div><div>Target: x86_64-apple-darwin15.0.0</div><div>Thread model: posix</div><div>InstalledDir: /Users/jim/toolchains/llvm/bin</div></div>
<br>_______________________________________________<br>
cfe-users mailing list<br>
<a>cfe-users@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users</a><br>
<br></blockquote></div><br></div></div>
</blockquote>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div></div></div><br></div></div>
</blockquote></div><br></div></div>
<br>_______________________________________________<br>
cfe-users mailing list<br>
<a href="mailto:cfe-users@lists.llvm.org" target="_blank">cfe-users@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users</a><br>
<br></blockquote></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>