Patchwork ObjC: another tiny performance tidyup

login
register
mail settings
Submitter Nicola Pero
Date April 12, 2011, 7:12 p.m.
Message ID <1302635531.839430268@192.168.4.58>
Download mbox | patch
Permalink /patch/90853/
State New
Headers show

Comments

Nicola Pero - April 12, 2011, 7:12 p.m.
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.
Mike Stump - April 12, 2011, 8:25 p.m.
On Apr 12, 2011, at 12:12 PM, Nicola Pero wrote:
> This saves a few thousands strlen() calls per compilation by reusing
> the length of selector strings instead of calculating it again.
> 
> Ok to commit ?

Ok.

Patch

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.  */