You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if caching reflection is too good. OpenJDK already do some cache optimization in java.lang.Class. As example if you see the method Class.getMethod calls privateGetPublicMethods() that uses ReflectionData that caches reflection info.
So I think that we can get too big improvements adding cache in the Mirror.
The idea behind this issue was to check if it was possible to use some internals and a bit of trickery to improve speed. At least till java 6, the openjdk had (I have not checked this in a long while) an internal interface to represent a method (sun.reflect.MethodAccessor) that was cached and reused inside Method (http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/reflect/Method.java ). Changing this method accessor to something we created, we could basically cache anything we wanted. But I never got too deep and still don't know if it is possible.
Reflection can be very expensive. Caching is a good solution.
The text was updated successfully, but these errors were encountered: