http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58258
Bug ID: 58258 Summary: cp_tree_equal and unknown symbol take up 70% of (astronomical) build time Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: geoffers+gccbug at gmail dot com Created attachment 30709 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30709&action=edit Slow compiling file With the attached file (sorry about the size — I'm going away on holiday and have run out of time to reduce it and would likely forget about it — though it is an improvement on the 2.3MB preprocessed source file it started off as!), g++ takes ~90s to compile, whereas clang++ takes ~3s. (On the original, non-reduced testcase, g++ took ~2h, clang++ took ~20s — a 400x difference.) This, somewhat obviously, isn't acceptable to me as an end-user. Notably expensive, from `perf record g++ -c -O0 -Wfatal-errors -std=c++11 -fpreprocessed -w -S -o /dev/null testcase.i`: 44.89% cc1plus cc1plus [.] 0x000000000065a167 14.73% cc1plus cc1plus [.] cp_tree_equal(tree_node*, tree_node*) 8.05% cc1plus cc1plus [.] dependent_name(tree_node*) 5.29% cc1plus cc1plus [.] operand_equal_p(tree_node const*, tree_node const*, unsigned int) 5.05% cc1plus cc1plus [.] ggc_internal_alloc_stat(unsigned long) To contrast with a limited sample of the original (I'm not recording the two-hour compilation, the perf.data file would be huge!): + 54.76% cc1plus cc1plus [.] 0x00000000006482d9 + 20.42% cc1plus cc1plus [.] cp_tree_equal(tree_node*, tree_node*) + 13.97% cc1plus cc1plus [.] dependent_name(tree_node*) I'm using the ArchLinux packaged GCC/Clang, i.e., $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /build/gcc/src/gcc-4.8-20130725/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --disable-install-libiberty --disable-multilib --disable-libssp --disable-werror --enable-checking=release Thread model: posix gcc version 4.8.1 20130725 (prerelease) (GCC)