RRF: 8187123: (reflect) Class#getCanonicalName and Class#getSimpleName is a part of performance issue

mandy chung mandy.chung at oracle.com
Thu May 3 18:48:17 UTC 2018



On 5/3/18 5:07 AM, Claes Redestad wrote:
>
>>
>> newReflectionData could be updated to copy the simpleName and 
>> canonicalName from oldReflectionData.  The perf isn't a concern when 
>> the class is being redefined.  As the class name is unchanged, it 
>> might be good to copy the names from older reflection data.
>
> I prefer not to, as I think we should optimize for the normal cases 
> here, which means either a first time create or replacing a cleared 
> reference. In neither of these cases there's any cached data to copy 
> over, so we'd add code (including at least one branch) that'd never be 
> beneficial for the normal case.  And as you say: perf probably isn't a 
> primary concern when classes are being redefined, so why add an 
> optimization that only applies to that case?

It's not solely for performance reason.  The names will never be 
redefined and so copying the names to a new reflection data makes this 
explicit.   I do see that the current implementation may require some 
clean up to do so.

I'm okay to leave it as is since this issue is to improve the 
performance for the common case.

Mandy



More information about the core-libs-dev mailing list