This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]