harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Cornwall (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-5900) [classlib][pack200] CpBands.parseCpSignature(Ljava/io/InputStream;) is hot
Date Mon, 07 Jul 2008 20:08:31 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-5900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611315#action_12611315
] 

Andrew Cornwall commented on HARMONY-5900:
------------------------------------------

A colleague of mine ran tprof on the IBM VM with the Harmony Pack200 unpack code and got the
following results for top JITted methods:

	211	8.1%	java/util/zip/Deflater.setInputImpl([BIIJ)V_411926f4
	177	6.8%	java/util/zip/Deflater.deflateImpl([BIIJI)I_41192854
	149	5.7%	java/io/DataOutputStream.writeChar(I)V_4a23a230
	97	3.7%	java/util/zip/DeflaterOutputStream.write([BII)V_4a1fffc6
	94	3.6%	org/apache/harmony/unpack200/CpBands.parseCpSignature(Ljava/io/InputStream;)V_4a23c0be
	77	2.9%	org/apache/harmony/pack200/BHSDCodec.decode(Ljava/io/InputStream;J)J_4118519c
	73	2.8%	org/apache/harmony/unpack200/bytecode/ClassConstantPool.add(Lorg/apache/harmony/unpack200/bytecode/ClassFileEntry;)Lorg/apache/harmony/unpack200/bytecode/ClassFileEntry;_4a231b1c
	67	2.6%	org/apache/harmony/unpack200/bytecode/ByteCode.doWrite(Ljava/io/DataOutputStream;)V_4a218cbc
	65	2.5%	org/apache/harmony/unpack200/CpBands.cpUTF8Value(Ljava/lang/String;IZ)Lorg/apache/harmony/unpack200/bytecode/CPUTF8;_411fc606
	64	2.4%	org/apache/harmony/unpack200/CpBands.parseCpSignature(Ljava/io/InputStream;)V_4a208866
	63	2.4%	java/io/DataOutputStream.writeChar(I)V_4a21ad7c

I suspect HARMONY-5888 and HARMONY-5889 will help with the stream methods, which weren't buffered
when the test was run. After that, parseCpSignature and BHSDCodec.decode are next on the list
of top methods.


> [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.


Mime
View raw message