ObjC: another tiny performance tidyup

Nicola Pero nicola.pero@meta-innovation.com
Tue Apr 12 19:12:00 GMT 2011


This saves a few thousands strlen() calls per compilation by reusing
the length of selector strings instead of calculating it again.

Ok to commit ?

Thanks

PS: I'll come back to hashtables later, as they do deserve some
discussion.  I want to get all the other obvious tiny changes in
first.

Index: ChangeLog
===================================================================
--- ChangeLog   (revision 172338)
+++ ChangeLog   (working copy)
@@ -1,5 +1,10 @@
 2011-04-12  Nicola Pero  <nicola.pero@meta-innovation.com>
 
+       * objc-act.c (build_keyword_selector): Use get_identifier_with_length
+       instead of get_identifier.
+
+2011-04-12  Nicola Pero  <nicola.pero@meta-innovation.com>
+
        * objc-act.c (objc_build_message_expr): Accept two arguments
        instead of one so that callers can simply pass the arguments
        without having to create a temporary chain to hold them.
Index: objc-act.c
===================================================================
--- objc-act.c  (revision 172338)
+++ objc-act.c  (working copy)
@@ -4668,7 +4668,7 @@ build_keyword_selector (tree selector)
       strcat (buf, ":");
     }
 
-  return get_identifier (buf);
+  return get_identifier_with_length (buf, len);
 }
 
 /* Used for declarations and definitions.  */




More information about the Gcc-patches mailing list