https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116285
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:5ac4be28822a4e6f506a69096f92d4675a7d5a72 commit r15-9026-g5ac4be28822a4e6f506a69096f92d4675a7d5a72 Author: Jason Merrill <ja...@redhat.com> Date: Mon Mar 24 15:28:04 2025 -0400 c++: optimize push_to_top_level [PR64500] Profiling showed that the loop to save away IDENTIFIER_BINDINGs from open binding levels was taking 5% of total compilation time in the PR116285 testcase. This turned out to be because we were unnecessarily trying to do this for namespaces, whose bindings are found through DECL_NAMESPACE_BINDINGS, not IDENTIFIER_BINDING. As a result we would frequently loop through everything in std::, checking whether it needs to be stored, and never storing anything. This change actually appears to speed up compilation for the PR116285 testcase by ~20%. The replaced comments referred either to long-replaced handling of classes and templates, or to wanting b to point to :: when the loop exits. PR c++/64500 PR c++/116285 gcc/cp/ChangeLog: * name-lookup.cc (push_to_top_level): Don't try to store_bindings for namespace levels.