The reflection penalty isn't that great.
  1. ASM is used to provide direct method access.
  2. Reflection invocation isn't that expensive, method lookup is the
slow bit, which is done in advance.
  3. There are many "invoke()" methods in the chain, but they are
called directly without the reflection overhead back and forth to
java.lang.reflect.Method.

Unless, of course, you have a large set of Concerns that is a mix of
Typed and Generic ones. But then, doing that functionality in a
non-Qi4j environment probably cause a much larger penalty on get the
call chains set up and executed in the same manner.

Btw, what is the similar numbers for creation in Spring with AOP
weaving enabled?

Cheers
Niclas

On Wed, Oct 31, 2012 at 4:40 AM, Stanislav Muhametsin
<[email protected]> wrote:
> Quoting Niclas Hedhman <[email protected]>:
>
>> Two comments only;
>>
>> 1. Object creation is not the only benchmark, is it?
>> In "real" applications, we often see that the performance is dying in
>> the hands of other subsystems, such as serialization, I/O,
>> recursive/complex algorithms and very seldom the management of objects
>> and method invocations.
>> I don't recall the exact path that a method takes, but I am pretty
>> sure it isn't 50 times that of a single call. And that is also hard to
>> measure, since it is difficult to know when hotspot will and will not
>> skew benchmark loops by all kind of eliminations...
>
>
> IIRC, every time composite method is invoked, reflection is used to inject
> things and then further invoke next method (concern or mixin). I'd say
> that's quite enough for being 50 times slower than just simply invoking a
> method on a bare object.
>
> There is some performance test in Qi4j tests, but it measures only creation
> time of composite vs creation time of bare object (IIRC at some point
> 400-800 times slower). I don't remember if there was performance test on
> invoking composite methods vs invoking methods on bare objects, which
> correspond to same behaviour as composites.
>
>
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev



-- 
Niclas Hedhman, Software Developer
河南南路555弄15号1901室。
http://www.qi4j.org - New Energy for Java

I live here; http://tinyurl.com/3xugrbk
I work here; http://tinyurl.com/6a2pl4j
I relax here; http://tinyurl.com/2cgsug

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to