MethodHandle performance with JMH
Aleksey Shipilev
aleksey.shipilev at oracle.com
Mon Mar 17 08:46:02 UTC 2014
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