RFR 8200696 : Optimal initial capacity of java.lang.Class.enumConstantDirectory
Martin Buchholz
martinrb at google.com
Thu Apr 5 04:24:39 UTC 2018
Hi Ivan,
I'm seeing
[2018-04-04 20:56:11,999] Agent[1]: stderr: WARNING: An illegal reflective
access operation has occurred
[2018-04-04 20:56:11,999] Agent[1]: stderr: WARNING: Illegal reflective
access by jdk.testlibrary.OptimalCapacity
(file:/tmp/jtr-BHhgGo/classes/lib/testlibrary/) to field
java.util.HashMap.table
[2018-04-04 20:56:11,999] Agent[1]: stderr: WARNING: Please consider
reporting this to the maintainers of jdk.testlibrary.OptimalCapacity
which seems likely a result of this change?
On Wed, Apr 4, 2018 at 4:54 PM, Ivan Gerasimov <ivan.gerasimov at oracle.com>
wrote:
> Thanks David and Claes!
>
> I changed the expression to (int)(universe.length / 0.75f) + 1 before
> pushing the fix and updated the Jira bug with more details.
>
> With kind regards,
>
> Ivan
>
>
>
> On 4/3/18 11:56 PM, Claes Redestad wrote:
>
>> Hi Ivan,
>>
>> looks good.
>>
>> Nit: maybe (int)(universe.length / 0.75f) + 1 to keep fp arithmetic to a
>> minimum.
>>
>> /Claes
>>
>> On 2018-04-04 01:22, Ivan Gerasimov wrote:
>>
>>> Hello!
>>>
>>> Yet another occurrence of not-optimally pre-sized HashMap.
>>>
>>> When java.lang.Class.enumConstantDirectory is created, the initial
>>> capacity is set to be (2 * universe.length), which is more than necessary
>>> in some cases.
>>>
>>> Choosing the capacity optimally will allow us to save a few bytes with
>>> some enum classes.
>>>
>>> Would you please help review this trivial fix?
>>>
>>> BUGURL: https://bugs.openjdk.java.net/browse/JDK-8200696
>>> WEBREV: http://cr.openjdk.java.net/~igerasim/8200696/00/webrev/
>>>
>>>
>>
>>
> --
> With kind regards,
> Ivan Gerasimov
>
>
More information about the core-libs-dev
mailing list