MethodHandle performance with JMH

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Mar 17 16:02:48 UTC 2014


Sure :)

-Aleksey.

On 03/17/2014 07:57 PM, Sergey Tselovalnikov wrote:
> I'm sorry, you are absolutely right. I missed this moment, thank you
> very much
> 
> 
> 2014-03-17 14:46 GMT+06:00 Aleksey Shipilev <aleksey.shipilev at oracle.com
> <mailto:aleksey.shipilev at oracle.com>>:
> 
>     Hi,
> 
>     On 03/16/2014 12:29 PM, Sergey Tselovalnikov wrote:
>     > I tried to measure performance of MethodHandle in comparison with
>     > reflection, but get Exception, because jmh uses generated code.
> 
>     I don't think this statement is grounded in reality, because the stack
>     trace you are getting originates the exception from your own benchmark
>     method:
> 
>     java.lang.invoke.WrongMethodTypeException: cannot convert
>     MethodHandle()Integer to (Object[])Object
>     ...
>     at
>     ru.serce.jmh.ReflectionMethodStaticAccess.testMethodHandle(ReflectionMethodStaticAccess.java:72)
>     ...
> 
>     > Test project:
>     > https://github.com/SerCeMan/reflection-access-tests
>     >
>     > I run tests from the terminal with command:
>     > mvn clean install && java -jar target/microbenchmarks.jar
>     > ".*MethodStatic.*" -wi 5 -i 5 -f 1  > compiled.txt
> 
>     Apparently, the MethodHandle tests are not there; and history does not
>     have any evidence of ReflectionMethodStaticAccess.testMethodHandleExact.
>     But I can already see the problem: compiling signature-polymorphic MH
>     tests with source/target 1.6 wouldn't work, make it 1.7.
> 
>     -Aleksey.
> 
> 
> 
> 
> -- 
> С уважением,
> Сергей Целовальников



More information about the jmh-dev mailing list