From patchwork Tue Apr 12 19:12:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Pero X-Patchwork-Id: 90853 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 7BA30B6F15 for ; Wed, 13 Apr 2011 05:12:26 +1000 (EST) Received: (qmail 20692 invoked by alias); 12 Apr 2011 19:12:25 -0000 Received: (qmail 20682 invoked by uid 22791); 12 Apr 2011 19:12:24 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL, BAYES_00, TW_BJ, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Apr 2011 19:12:15 +0000 Received: from eggs.gnu.org ([140.186.70.92]:60696) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Q9j0Y-0006TQ-OW for gcc-patches@gnu.org; Tue, 12 Apr 2011 15:12:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9j0X-0003jq-5Q for gcc-patches@gnu.org; Tue, 12 Apr 2011 15:12:14 -0400 Received: from smtp141.iad.emailsrvr.com ([207.97.245.141]:58101) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9j0W-0003iq-Sf for gcc-patches@gnu.org; Tue, 12 Apr 2011 15:12:13 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp54.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id 027D52B09C1 for ; Tue, 12 Apr 2011 15:12:11 -0400 (EDT) Received: from dynamic3.wm-web.iad.mlsrvr.com (dynamic3.wm-web.iad1a.rsapps.net [192.168.2.152]) by smtp54.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id E10952B0938 for ; Tue, 12 Apr 2011 15:12:11 -0400 (EDT) Received: from meta-innovation.com (localhost [127.0.0.1]) by dynamic3.wm-web.iad.mlsrvr.com (Postfix) with ESMTP id CE959332006E for ; Tue, 12 Apr 2011 15:12:11 -0400 (EDT) Received: by www2.webmail.us (Authenticated sender: nicola.pero@meta-innovation.com, from: nicola.pero@meta-innovation.com) with HTTP; Tue, 12 Apr 2011 21:12:11 +0200 (CEST) Date: Tue, 12 Apr 2011 21:12:11 +0200 (CEST) Subject: ObjC: another tiny performance tidyup From: "Nicola Pero" To: "gcc-patches@gnu.org" MIME-Version: 1.0 X-Type: plain Message-ID: <1302635531.839430268@192.168.4.58> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 207.97.245.141 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 + * objc-act.c (build_keyword_selector): Use get_identifier_with_length + instead of get_identifier. + +2011-04-12 Nicola Pero + * 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. */