RFR(s): JDK-8214687 Optimize Collections.nCopies().hashCode()

Martin Buchholz martinrb at google.com
Wed Dec 12 04:25:26 UTC 2018


I used to believe that,  but apparently I was wrong.
https://openjdk.markmail.org/thread/rfqfultw35i2az45

On Tue, Dec 11, 2018 at 8:14 PM Zheka Kozlov <orionllmain at gmail.com> wrote:

> Would be better to add @Stable to the fields instead? (`n` and `element`
> are final, so @Stable is OK here)
>
> ср, 12 дек. 2018 г. в 11:02, Martin Buchholz <martinrb at google.com>:
>
>> In performance critical code, we don't trust hotspot to not reload final
>>> fields.  Other forEach methods do this, e.g.
>>
>>
>>         final Object[] es = queue;
>>         for (int i = 0, n = size; i < n; i++)
>>             action.accept((E) es[i]);
>>
>>
>


More information about the core-libs-dev mailing list