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

Rémi Forax forax at
Sun Dec 4 22:13:39 UTC 2011

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.

BTW, if we had to remove some fields, I vote for moving all fields 
related to the reflection
in a delegate class. Looking up for members is slow so most of the code 
that call reflection
methods use their own cache, so the performance impact will be small in 
my opinion
(I have no data to prove that :)


More information about the core-libs-dev mailing list