harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivanov, Alexey A" <alexey.a.iva...@intel.com>
Subject RE: [optimization] Algorithmic tricks
Date Thu, 27 Jul 2006 10:01:20 GMT
>-----Original Message-----
>From: Denis Kishenko [mailto:dkishenko@gmail.com]
>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 <mike.fursov@gmail.com>:
>>
>> 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 < dkishenko@gmail.com> 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: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message