Hello everyone,
Sometimes I saw code which does not store reflection data structure MethodInfo, but stores MethodHandle each time and converts MethodHandle to MethodInfo (using GetMethodFromHandle) when MethodInfo is used to invoke the specific method using reflection.
My understanding is,
1. Using method handle could save memory;
2. But each time doing conversion from method handle to method info uses additional time.
So, it is a memory footprint/performance trade-off of choosing method info and method handle.
My questions is whether my above understanding of whether to use method handle or method info is correct. If not, what are the correct points?
thanks in advance,
George
Bechir BejaouiPosted Sep 11, 2008, 10:04 PM
George GeorgePosted Sep 11, 2008, 9:37 PM
Thanks, it is clear now.
regards,
George
Bechir BejaouiPosted Sep 11, 2008, 9:13 PM
George GeorgePosted Sep 9, 2008, 2:17 AM
Do you mean there is no need to store method info and only method handle is needed (please feel free to correct me if I wrongly understand your points)? If yes, I do not agree, since in order to invoke a method, method info object is needed other than the method handle.
Any comments?
regards,
George
Bechir BejaouiPosted Sep 8, 2008, 1:23 PM
1. Using method handle could save memory;
2. But each time doing conversion from method handle to method info uses additional time.
but thinks couldn't be seen from this corner as method handle and method info are not designed for the same purpose whereas it seems to be.
the method handle is used in case where the purpuse is purely the execution of the method. In the other hand if you want to store any other information about the method then you make use of the MethodInfo, this could be remarked from the set of properties and members of each class