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]

[C++ PATCH,committed] Compile speed improvement for template


Hi

This patch slightly speedup 'register_specialization' a bit (inspired by the
testcase in PR6749 I just fixed).  In an 'if' condition in the patch, the
function call 'comp_template_args' is expensive compare to the other test.
And the two can be safely switched.  With the patch, rebuilding libstdc++ and
regtesting libstdc++ and g++ testsuite reduces from 57 minutes to 56 minutes
(counting user time).

Tested on i686-pc-linux-gnu.  Committed to mainline as obvious.

--Kriang


2004-08-20  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

	* pt.c (register_specialization): Check DECL_TEMPLATE_SPECIALIZATION
	before calling comp_template_args.


diff -cprN gcc-main-save/gcc/cp/pt.c gcc-main-new/gcc/cp/pt.c
*** gcc-main-save/gcc/cp/pt.c	Mon Aug 16 21:34:33 2004
--- gcc-main-new/gcc/cp/pt.c	Fri Aug 20 21:07:24 2004
*************** register_specialization (tree spec, tree
*** 1079,1086 ****
  	 more convenient to simply allow this than to try to prevent it.  */
        if (fn == spec)
  	return spec;
!       else if (comp_template_args (TREE_PURPOSE (s), args)
! 	       && DECL_TEMPLATE_SPECIALIZATION (spec))
  	{
  	  if (DECL_TEMPLATE_INSTANTIATION (fn))
  	    {
--- 1079,1086 ----
  	 more convenient to simply allow this than to try to prevent it.  */
        if (fn == spec)
  	return spec;
!       else if (DECL_TEMPLATE_SPECIALIZATION (spec)
! 	       && comp_template_args (TREE_PURPOSE (s), args))
  	{
  	  if (DECL_TEMPLATE_INSTANTIATION (fn))
  	    {


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