Faster Repeated Access to Java Class Names Coming to Java?
Claes Redestad has posted the message " RRF: 8187123: (reflect) Class#getCanonicalName and Class#getSimpleName is a part of performance issue " on the core-libs-dev mailing list in which he requests review of a proposed change "to enable caching of getCanonicalName and getSimpleName , repeated calls of which has been reported to be a performance bottleneck." He adds that "the caching improves performance of these methods by up to 20x." An obvious solution to the performance issue might have been to add the name of the class as a field to the Class class definition, but Redestad points out in the associated bug JDK-8187123 that "we should avoid adding more fields to java.lang.Class ." Instead, this bug was addressed by the idea to " piggy back off other reflection information that is cached in ReflectionData ." ReflectionData is a nested ( private static ) class defined within the Class class. The Class class's reference to...