RFR: 8198888: Reduce string allocation churn in InvokerBytecodeGenerator

Claes Redestad claes.redestad at oracle.com
Thu Mar 1 13:02:59 UTC 2018


Hi,

as equals/hashCode on Class mirrors are already using identity 
semantics, I don't
think we actually gain much from using an IdentityHashMap, and I don't 
want to add
new dependencies to this java.lang.invoke (we have some ambition to 
reduce the
number of java.util classes used from java.lang.invoke so as to make it 
less
troublesome to use lambdas et al from java.util).

Thanks!

/Claes

On 2018-03-01 13:31, Andrej Golovnin wrote:
> Hi Claes,
>
> src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
>
>    96     /** Internal name lookup cache. */
>    97     private HashMap<Class<?>, String> nameMap;
>
> 617             nameMap = new HashMap<>(2);
>
> Have you tested it with IdentityHashMap? Maybe it would be even better
> as Class<?> does not have own implementations of #hasCode() and
> #equals() methods.
>
> Best regards,
> Andrej Golovnin
>
> On Thu, Mar 1, 2018 at 1:14 PM, Claes Redestad
> <claes.redestad at oracle.com> wrote:
>> Hi,
>>
>> two trivial optimizations that get rid of a few percent on ISC startup
>> tests.
>>
>> Webrev: http://cr.openjdk.java.net/~redestad/8198888/jdk.00/
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8198888
>>
>> Thanks!
>>
>> /Claes



More information about the core-libs-dev mailing list