geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <>
Subject Re: Reflection Bad, OO and direct Method invocation Good...
Date Sat, 09 Aug 2003 16:26:30 GMT
On Saturday, August 9, 2003, at 10:38 AM, Aaron Mulder wrote:

> On Sat, 9 Aug 2003, John C. Dale wrote:
>> Microbenchmarks can in fact be misleading when we aren't talking about
>> as much as a factor of 10!  Reflection, in the best case scenario 
>> below,
>> was a factor of 10 slower!  The bottom line is that reflection takes a
>> lot more electricity than does non-reflection.
> 	No, really, it can be misleading by a factor of 10.  The compiler
> or VM can "do things" (like inlining a method when you're testing the 
> time
> it takes to call different kinds of methods) that totally defeat a
> microbenchmark.  I will certainly agree that "reflection is 
> significantly
> slower", but I don't think it's valuable to point to specific numbers 
> on a
> benchmark like you showed.

To truly test the speed of a direct invocation you need to give the VM 
something it cannot inline.  The only way I know how to do that is to 
make the method you are calling just under the maximum method size, 64k.


View raw message