This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: minor C++ front end compile speed improvement
- From: Matt Austern <austern at apple dot com>
- To: "gcc-patches at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 1 Dec 2004 10:01:56 -0800
- Subject: PATCH: minor C++ front end compile speed improvement
I'm seeing a bit under 0.5% improvement in QT builds from this.
(Again: close to the limits of accuracy of my measurements, so take
that number with a grain of salt.) We avoid a test and a dereference
in namespace_binding when we're looking things up in the global
namespace, since we know the global namespace can't be an alias.
OK to commit to mainline?
--Matt
* name-lookup.c (namespace_binding): Avoid namespace alias check for
global namespace
Index: gcc/cp/name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.98
diff -p -r1.98 name-lookup.c
*** gcc/cp/name-lookup.c 29 Nov 2004 14:17:22 -0000 1.98
--- gcc/cp/name-lookup.c 1 Dec 2004 17:59:02 -0000
*************** namespace_binding (tree name, tree scope
*** 2735,2741 ****
if (scope == NULL)
scope = global_namespace;
! scope = ORIGINAL_NAMESPACE (scope);
binding = cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope),
name);
return binding ? binding->value : NULL_TREE;
--- 2735,2742 ----
if (scope == NULL)
scope = global_namespace;
! else
! scope = ORIGINAL_NAMESPACE (scope);
binding = cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope),
name);
return binding ? binding->value : NULL_TREE;