Skip to content

clang is slower than gcc when compiling some codes in chrome #31385

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 32037
Resolution FIXED
Resolved on Jan 24, 2018 03:57
Version trunk
OS Linux
Blocks #24719
Attachments row_common.cc, preprocessed
Reporter LLVM Bugzilla Contributor
CC @chandlerc,@topperc,@zmodem,@hfinkel,@lalozano,@RKSimon,@rnk,@rotateright
Fixed by commit(s) 323320

Extended Description

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions