Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 36424 invoked from network); 7 Jul 2008 20:14:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Jul 2008 20:14:52 -0000 Received: (qmail 74291 invoked by uid 500); 7 Jul 2008 20:14:53 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 74270 invoked by uid 500); 7 Jul 2008 20:14:53 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 74258 invoked by uid 99); 7 Jul 2008 20:14:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jul 2008 13:14:53 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jul 2008 20:14:09 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id B96D6234C15B for ; Mon, 7 Jul 2008 13:14:31 -0700 (PDT) Message-ID: <1251881603.1215461671758.JavaMail.jira@brutus> Date: Mon, 7 Jul 2008 13:14:31 -0700 (PDT) From: "Andrew Cornwall (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-5900) [classlib][pack200] CpBands.parseCpSignature(Ljava/io/InputStream;) is hot In-Reply-To: <55920016.1215453391789.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-5900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611318#action_12611318 ] Andrew Cornwall commented on HARMONY-5900: ------------------------------------------ (These numbers are ticks and %ticks). And right below them is: 63 2.4% java/io/DataOutputStream.writeChar(I)V_4a21ad7c 55 2.1% org/apache/harmony/unpack200/CpBands.search([Ljava/lang/String;Ljava/lang/String;)I_41187efc > [classlib][pack200] CpBands.parseCpSignature(Ljava/io/InputStream;) is hot > -------------------------------------------------------------------------- > > Key: HARMONY-5900 > URL: https://issues.apache.org/jira/browse/HARMONY-5900 > Project: Harmony > Issue Type: Wish > Components: Classlib > Affects Versions: 5.0M6 > Environment: All Pack200 HEAD > Reporter: Andrew Cornwall > > The method org/apache/harmony/unpack200/CpBands.parseCpSignature(Ljava/io/InputStream;) appears to be very hot. I tried initially to optimize it by caching some of its arrays: > static void clearArrayCache() { > arrayCache = new SegmentConstantPoolArrayCache(); > } > > private static SegmentConstantPoolArrayCache arrayCache = new SegmentConstantPoolArrayCache(); > > private int search(String[] array, String string) { > if(array.length > 30) { > List indexes = arrayCache.indexesForArrayKey(array, string); > if (indexes.size() == 0) { > return -1; > } > return ((Integer)indexes.get(0)).intValue(); > } else { > for (int i = 0; i < array.length; i++) { > if(array[i].equals(string)) { > return i; > } > } > return -1; > } > } > ... but that didn't appear to increase performance. (Maybe all the searches are done once?) > Any ideas how to tune parseCpSignature to get it faster? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.