review request (L): 7030453: JSR 292 ClassValue.get method is too slow

Joe Darcy joe.darcy at oracle.com
Mon Dec 5 00:27:42 UTC 2011


On 12/4/2011 2:13 PM, Rémi Forax wrote:
> On 12/04/2011 08:38 PM, Joe Darcy wrote:
>> Hi John,
>>
>> Are there alternatives to adding two new fields to java.lang.Class?  
>> I assume most Class'es won't have ClassValue information associated 
>> with them.
>>
>> -Joe
>
> If you use Groovy, JRuby or Nashorn in your code, all visible classes 
> will use this two fields.
>
> Any alternative will slow down the access to the class value.

In the mean time, all the non-Groovy, non-JRuby, non-Nashorn, etc. uses 
of class Class and all the classes not visible in those environments 
when they are being used will be larger.

Adding the fields may be the right time/space trade-off, but I think the 
point merits some discussion given how many Class objects get created 
and the relative proportion of Java executions where ClassValue is 
currently used.

The more reasonable time/space trade-off can change over time of course.

-Joe




More information about the core-libs-dev mailing list