Need reviewer for forward port of 6815768 (File.getXXXSpace) and 6815768 (String.hashCode)

Alan Bateman Alan.Bateman at Sun.COM
Fri Feb 26 19:32:32 UTC 2010


Ulf Zibis wrote:
> Am 26.02.2010 16:25, schrieb Ulf Zibis:
>> So optimum could be:
>>
>
> I have one more ...
> Additionally we can save double incrementing of int i and off:
>
> public int hashCode() {
>   int h = hash;
>   if (h == 0) {
>     int len = count;
>     if (len>  0) {
>       char[] val = value;
> //      for (int i = offset, len += i; i<  len; ) // would be nice 
> syntax ->  RFE to project coin
>       for (int i = offset, limit = len += i; i<  len; i++)
>         h = 31*h + val[i];
>       hash = h;
>     }
>   }
>   return h;
> }
>
>
> - Ulf
>
For these other suggestions it would be great to create micro-benchmarks 
and try our your changes.

For now though, as I said, I'm just fixing the method to avoid the store 
for the empty string case.

-Alan.



More information about the core-libs-dev mailing list