Message ID | 1294961576.573924085@192.168.4.58 |
---|---|
State | New |
Headers | show |
On Jan 13, 2011, at 3:32 PM, Nicola Pero wrote: > This trivial patch speeds up the Objective-C compiler by about 1% percent by removing > the objc-act.c-specific hash function and simply using the hash value already computed > by the rest of the compiler for identifiers. :-) > I know we are in stage 4 and optimizations are not for this stage, but the patch is so obvious to me, maybe it could go in. > > Ok to commit ? When we hit stage1, Ok. For this stage, I just don't think it should go in. I'm happy to have a RM overrule me, if they choose. Now, I might bend to rules for some types of work, like quality polishing of the new objc code... or finishing out the implementation if there are some rough corners that just weren't completely finished. Very important features, like, m64 darwin support, might also be worth the risk.
Index: objc-act.c =================================================================== --- objc-act.c (revision 168761) +++ objc-act.c (working copy) @@ -8646,19 +8646,8 @@ } /* Compute a hash value for a given method SEL_NAME. */ +#define hash_func(X) IDENTIFIER_HASH_VALUE(X) -static size_t -hash_func (tree sel_name) -{ - const unsigned char *s - = (const unsigned char *)IDENTIFIER_POINTER (sel_name); - size_t h = 0; - - while (*s) - h = h * 67 + *s++ - 113; - return h; -} - static void hash_init (void) { Index: ChangeLog =================================================================== --- ChangeLog (revision 168761) +++ ChangeLog (working copy) @@ -1,3 +1,8 @@ +2011-01-13 Nicola Pero <nicola.pero@meta-innovation.com> + + * objc-act.c (hash_func): Reuse IDENTIFIER_HASH_VALUE instead of + computing a new hash value. + 2011-01-08 Iain Sandoe <iains@gcc.gnu.org> * objc-act.c (objc_finish_foreach_loop): Mark collection expression