https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65328
Bug ID: 65328 Summary: GCC perf issue when compiling templates - 120x slower than Clang Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: juchem at gmail dot com Debian's g++ 4.9.2 and gcc 4.8.4 are extremely slow at compiling some templates. They take more than 1h to compile the same code that Clang 3.4 needs 39 seconds. How to reproduce: $ git clone https://github.com/facebook/fatal.git \ && cd fatal && git checkout -b dev origin/dev \ && clang++-3.4 --version && time clang++-3.4 -Wall -std=c++11 -I . \ fatal/type/benchmark/prefix_tree_benchmark.cpp \ && g++-4.8 --version && time g++-4.8 -Wall -std=c++11 -I . \ fatal/type/benchmark/prefix_tree_benchmark.cpp \ && g++-4.9 --version && time g++-4.9 -Wall -std=c++11 -I . \ fatal/type/benchmark/prefix_tree_benchmark.cpp Output: Cloning into 'fatal'... remote: Counting objects: 1124, done. remote: Compressing objects: 100% (226/226), done. remote: Total 1124 (delta 119), reused 0 (delta 0), pack-reused 884 Receiving objects: 100% (1124/1124), 803.31 KiB | 1.20 MiB/s, done. Resolving deltas: 100% (727/727), done. Checking connectivity... done. Branch dev set up to track remote branch dev from origin. Switched to a new branch 'dev' Debian clang version 3.4.2-13 (tags/RELEASE_34/dot2-final) (based on LLVM 3.4.2) Target: x86_64-pc-linux-gnu Thread model: posix real 0m39.205s user 0m37.416s sys 0m1.432s g++-4.8 (Debian 4.8.4-1) 4.8.4 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. real 64m37.227s user 61m42.556s sys 0m10.604s g++-4.9 (Debian 4.9.2-10) 4.9.2 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. real 65m33.790s user 63m52.544s sys 0m7.664s