>-----Original Message-----
>From: Denis Kishenko [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, July 26, 2006 7:25 PM
>To: harmony-dev@incubator.apache.org
>Subject: Re: [optimization] Algorithmic tricks
>
>Mikhail, you are right, in some places it can be very critical.
>
>
>
>Now HashCode works only with primitive types int, long, float, double,
>boolean and doesn't override String.hashCode(), so don't care about
strings.

It can handle Objects and uses object.hashCode().

>
>
>Actually I don't understand the purpose of *combine()* method. I
suppose we
>can reduce it to improve perfomance.

combine() performs the calculations. append() is a convenience method
that returns the object it was called upon, so that your example can be
re-written as follows:

     public int hashCode() {
        return new HashCode().append(m00)
                             .append(m01)
                                 .append(m02)
                                 .append(m10)
                                 .append(m11)
                                 .append(m12)
                             .hashCode();
    }

It's like StringBuffer.append().


Regards,
Alexey.

>
>
>
>2006/7/26, Mikhail Fursov <[EMAIL PROTECTED]>:
>>
>> Some hashCode functions are actually very *hot* methods (e.g. String)
>> In this case I think that a bad but fast hashCode() could be better
than
>> good but slow. May be I'm wrong but only tests can show the
difference.
>> So if you have tests, I'm +1
>>
>> On 7/26/06, Denis Kishenko < [EMAIL PROTECTED]> wrote:
>> >
>> >
>> > Any comments?
>> >
>>
>>
>> --
>> Mikhail Fursov
>>
>>
>
>
>--
>Denis M. Kishenko
>Intel Middleware Products Division


--
Alexey A. Ivanov
Intel Middleware Product Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to