commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Venkatesh Prasad Ranganath <vrangan...@sbcglobal.net>
Subject Re: Can we optimize HashCodeBuilder.append(Object)?
Date Mon, 02 Jul 2007 10:05:44 GMT
On Jul 2, 2007, at 2:49 AM, Stephen Colebourne wrote:

> Hi,
> Have you got figures to show what difference the code change makes?

In the profiling data mentioned in my earlier mail (and below), the  
execution of java.lang.Class.isArray() (triggered via run1()) takes  
up 45% of the total execution time while run2() takes up only 2.8% of  
the total execution time.  It is approximately a 15x improvement.  If  
the [lang] team agrees on this, then I can raise the call and post a  
fix.

> If so, perhaps you could raise a JIRA call so we can process this  
> for [lang].
>
> thanks
> Stephen
>
> Venkatesh Prasad Ranganath wrote:
>> Hi,
>> I am using HashCodeBuilder and I found that the use of  
>> Class.isArray()
>> method in append(Object) to be a bottleneck.  Following program and
>> jprof data illustrates the bottleneck along with a solution.  I was
>> curious if we can integrate the solution code in
>> OptimizedHashCodeBuilder.append(Object) into
>> HashCodeBuilder.append(Object) in the upcoming version 2.3 release of
>> Commons Lang.
>> CPU SAMPLES BEGIN (total = 71) Sat Jun 30 16:51:43 2007
>> rank   self  accum   count trace method
>>    1 45.07% 45.07%      32 300138 java.lang.Class.isArray
>>    2 14.08% 59.15%      10 300141 java.util.AbstractList.hashCode
>>    3 12.68% 71.83%       9 300142 java.util.AbstractList.hashCode
>>    4  4.23% 76.06%       3 300030
>> sun.nio.cs.UTF_8$Decoder.decodeArrayLoop   5  4.23% 80.28%       3
>> 300144 java.util.AbstractList.hashCode
>>    6  2.82% 83.10%       2 300143 Test.run2
>>    7  2.82% 85.92%       2 300139 java.util.ArrayList.get
>>    8  1.41% 87.32%       1 300140 java.util.AbstractList.hashCode
>>    9  1.41% 88.73%       1 300145 java.util.AbstractList.hashCode
>>   10  1.41% 90.14%       1 300027 sun.nio.cs.UTF_8$Decoder.<init>
>>   11  1.41% 91.55%       1 300012 java.nio.DirectByteBuffer.<init>
>>   12  1.41% 92.96%       1 300089 sun.security.provider.Sun.<clinit>
>>   13  1.41% 94.37%       1 300132 sun.security.provider.Sun.<init>
>>   14  1.41% 95.77%       1 300071 java.lang.StringCoding.decode
>>   15  1.41% 97.18%       1 300031
>> sun.reflect.NativeConstructorAccessorImpl.newInstance  16  1.41%
>> 98.59%       1 300048 java.net.URLClassLoader.defineClass
>>   17  1.41% 100.00%       1 300137
>> sun.net.www.ParseUtil.canonizeStringCPU SAMPLES END

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message