编译时间明显慢于GCC

时间:2012-12-18 17:20:25

标签: clang

我看到Clang编译与GCC相比有四个减速因素。知道是什么原因引起的吗?

ebg@tsuki(250)$ time /usr/bin/cc -DHC4 -DSAFETY -DNOREDUCE -DNFAIR=3 -O2  -o files2 pan.c    
real    2m3.073s
user    1m59.484s
sys 0m3.585s

ebg@tsuki(251)$ time /usr/local/gcc/bin/gcc -DHC4 -DSAFETY -DNOREDUCE -DNFAIR=3 -O2  -o files1 pan.c
real    0m28.310s
user    0m27.590s
sys 0m0.706s

ebg@tsuki(252)$ /usr/bin/cc -v
Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix

ebg@tsuki(253)$ /usr/local/gcc/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc/libexec/gcc/x86_64-apple-darwin10.7.0/4.6.0/lto-wrapper
Target: x86_64-apple-darwin10.7.0
Configured with: ./configure --prefix=/usr/local/gcc --enable-languages='c c++' --enable-lto --with-gmp=/usr/local/gcc --with-mpfr=/usr/local/gcc --with-mpc=/usr/local/gcc
Thread model: posix
gcc version 4.6.0 (GCC) 

1 个答案:

答案 0 :(得分:3)

当我遇到同样的问题时,由于clang是为调试模式而不是发布模式构建的。