<html>
    <head>
      <base href="http://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang is slower than gcc when compiling some codes in chrome"
   href="http://bugs.llvm.org/show_bug.cgi?id=32037">32037</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang is slower than gcc when compiling some codes in chrome
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>laszio@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=18016" name="attach_18016" title="row_common.cc, preprocessed">attachment 18016</a> <a href="attachment.cgi?id=18016&action=edit" title="row_common.cc, preprocessed">[details]</a></span>
row_common.cc, preprocessed

This is about compile time, not code quality.

When building chrome, there are some objects that take noticeably longer than
gcc. Here are the top 5:

diff / clang-4.0 time / gcc-4.9.2 time / object
17.752848, 58.020705, 40.267857,
obj/third_party/sqlite/chromium_sqlite3/sqlite3.o
10.927715, 15.727189, 4.799474, obj/third_party/libyuv/libyuv/row_common.o
8.964672, 19.499460, 10.534788, obj/v8/v8_base/wasm-interpreter.o
7.865181, 11.146169, 3.280988, obj/third_party/libvpx/libvpx/variance.o
5.407040, 15.328771, 9.921731,
obj/components/policy/cloud_policy_proto_generated_compile_proto/cloud_policy.pb.o

Although this is comparing apples to oranges, it would be nice to make clang
run faster if there are some low hanging fruits. One possibility might be
row_common.o, which is compiled with -march=corei7. Removing the option make it
4x faster.

$ time clang -target x86_64-cros-linux-gnu -O2 -c row_common.cc -march=corei7
real    0m6.920s
user    0m6.900s
sys     0m0.022s

$ time clang -target x86_64-cros-linux-gnu -O2 -c row_common.cc
real    0m1.565s
user    0m1.526s
sys     0m0.037s


Top 10 time-consuming functions:

# Overhead  Command           Shared Object     Symbol                          
# ........  ................  ................ 
.................................
#
    12.08%  clang-4.0         clang-4.0         [.]
combineX86ShufflesRecursively                               
     8.81%  clang-4.0         libc-2.23.so      [.] malloc                      
     8.05%  clang-4.0         clang-4.0         [.] llvm::extractConstantMask   
     6.86%  clang-4.0         clang-4.0         [.] llvm::APInt::shlSlowCase    
     4.84%  clang-4.0         clang-4.0         [.] llvm::APInt::lshr           
     2.13%  clang-4.0         libstdc++.so.6.0  [.] operator new                
     1.92%  clang-4.0         clang-4.0         [.] peekThroughBitcasts         
     1.63%  clang-4.0         clang-4.0         [.] llvm::DecodePSHUFBMask      
     1.61%  clang-4.0         clang-4.0         [.] llvm::APInt::operator|=     
     1.39%  clang-4.0         clang-4.0         [.] llvm::APInt::initSlowCase</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>