On Mon, 10 Jan 2022 09:53:56 GMT, Сергей Цыпанов <d...@openjdk.java.net> wrote:

>> src/java.base/share/classes/java/lang/reflect/Executable.java line 317:
>> 
>>> 315:             final boolean realParamData = hasRealParameterData();
>>> 316:             final Type[] genericParamTypes = 
>>> getGenericParameterTypes();
>>> 317:             final Type[] nonGenericParamTypes = 
>>> getSharedParameterTypes();
>> 
>> (If removing these allocations is important, I note that 
>> `ConstructorRepository.getGenericParameterTypes()` lacks an equivalent to 
>> `getSharedParameterType` for trusted callers)
>> 
>> Similarly here I'm not sure the win from avoiding the clone is worth 
>> delegating the additional responsibility. You could still do this here if 
>> you add `.clone()` after `nonGenericParamTypes` on L344
>
> @cl4es Do you think it's worth creating a separate PR for 
> `ConstructorRepository.getGenericParameterTypes()`?

@stsypanov the remaining improvements in this PR are fine, simple wins. Adding 
complexity to expose shared arrays would warrant a bit more proof, however. For 
example a microbenchmark. My gut feeling is it's a marginal win on likely to be 
rare operations, but I couldn't know for sure without any evidence.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6782

Reply via email to