[PATCH] simple speedup for Darwin's stubs/non-lazy symbol finding

Andrew Pinski pinskia@physics.uc.edu
Fri Jun 25 13:06:00 GMT 2004


> 
> > 
> > When I was looking into how I could get PR8361 faster on Mac OS X,
> > I noticed the top functions were caused by the darwin back-end.
> > This patch fixes some of the issue dealing with the back-end but
> > looking into the length of the strings before calling strcmp.
> > This is faster as we already know the length for the IDENTIFER_NODE,
> > IDENTIFIER_LENGTH.
> > 
> > Orginal speed on a dual 2.5GHz G5: 18 seconds
> > After change to machopic_stub_name: 16.650 seconds
> > After change to machopic_non_lazy_ptr_name: 16.1 seconds.
> > 
> > I have another change to remove machopic_indirect_call_target
> > but I have not fixed the i386-darwin back-end yet to do the
> > output right.
> > 
> > With the removal of machopic_indirect_call_target: 14.3 seconds.
> > (but note this was not a total removal, just of all code in the function).
> > 
> > All measurements were done with CFLAGS="-O2 -g" with the mainline compiler
> > as the building the compiler.
> > 
> > OK? Bootstrapped on powerpc-apple-darwin with no regressions.
> 
> One more I noticed which gets it down to 15.3 seconds
> (without the removal of machopic_indirect_call_target).
> 
> With removal of machopic_indirect_call_target: 13.6 seconds.
> 
> OK? Boostrapped on powerpc-apple-darwin with no regressions.
> 
> Oh by the way I made sure that the code for PR8361 was the same for all
> of these compilers.

Another small decrease in compile time, moving around a small function and
declaring it as inline.

After this change: 14.9 seconds
(before removal of machopic_indirect_call_target)

With the removal of 13.5 seconds.

OK? Bootstrapped on powerpc-apple-darwin with no regressions.

Thanks,
Andrew Pinski

ChangeLog:
	* config/darwin.c (darwin_strip_name_encoding): Move to
	after name_needs_quotes and declare as inline.


Index: darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.69
diff -u -p -r1.69 darwin.c
--- darwin.c	3 Jun 2004 22:15:08 -0000	1.69
+++ darwin.c	25 Jun 2004 07:56:14 -0000
@@ -58,6 +58,15 @@ name_needs_quotes (const char *name)
   return 0;
 }
 
+
+/* Undo the effects of the darwin_encode_section_info.  */
+
+inline const char *
+darwin_strip_name_encoding (const char *str)
+{
+  return str[0] == '!' ? str + 4 : str;
+}
+
 /*
  * flag_pic = 1 ... generate only indirections
  * flag_pic = 2 ... generate indirections and pure code
@@ -1055,14 +1072,6 @@ darwin_encode_section_info (tree decl, r
     update_stubs (XSTR (sym_ref, 0));
 }
 
-/* Undo the effects of the above.  */
-
-const char *
-darwin_strip_name_encoding (const char *str)
-{
-  return str[0] == '!' ? str + 4 : str;
-}
-
 /* Scan the list of non-lazy pointers and update any recorded names whose
    stripped name matches the argument.  */
 




More information about the Gcc-patches mailing list