MethodHandle lookup&invocation performance
Jochen Theodorou
blackdrag at gmx.org
Sat Jul 9 03:01:01 PDT 2011
Am 09.07.2011 10:48, schrieb Hiroshi Nakamura:
> Hello,
>
> I heard that jsr292 makes dynamic method lookup&invocation faster than
> reflection so I did some performance comparison against plain
> reflection. I'm sending this mail since the result looks strange to
> me.
>
> Code is here:
> https://raw.github.com/nahi/jsr292-sandbox/master/src/jp/gr/java_conf/jruby/MethodHandleTest.java
lookup I don't know. I am not sure about the recent versions, I think
the lookup is using the same "core" as Reflection plus additional
checks. I don't expect that to be faster. It would be very nice though.
The performance of the invocation cannot be meassured like you do it I
think. The big pro comes from the ability to inline the method calls,
but this is only present if you use the invokedynamic bytecode
instruction. There is currently no way in Java to express invokedynamic.
And a third point... even if there where invokedynamic used, I think in
your case it would not really bring forth the real performance
possibilities, since your receiver is changing all the time.
But in general I must say, I would have expected the performance to be
at least near Reflection as well. I mean the situation is for Reflection
not all that better.
bye blackdrag
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead
http://blackdragsview.blogspot.com/
For Groovy programming sources visit http://groovy.codehaus.org
More information about the mlvm-dev
mailing list