On 4/30/18 5:49 AM, Claes Redestad wrote:
Hi,

please review this patch to enable caching of getCanonicalName and getSimpleName, repeated calls of which has been reported to be a performance bottleneck. The caching improves performance of these methods by up to 20x.

Rather than adding new fields to Class itself, which would have footprint implications on classes, we can piggy-back on Class$ReflectionData object.

Webrev: http://cr.openjdk.java.net/~redestad/8187123/open.02/
Bug: https://bugs.openjdk.java.net/browse/JDK-8187123


It's a fine idea to leverage ReflectionData to cache the names.  Can you update line 2916 for this change?  For example, reflection data caches the names and members.  It will get invalidated when JVM TI RedefineClasses is called.

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.

Mandy



Reply via email to