Is it possible to make java.lang.invoke.MethodHandle as fast as direct invokation?
问题 I'm comparing performance of MethodHandle::invoke and direct static method invokation. Here is the static method: public class IntSum { public static int sum(int a, int b){ return a + b; } } And here is my benchmark: @State(Scope.Benchmark) public class MyBenchmark { public int first; public int second; public final MethodHandle mhh; @Benchmark @OutputTimeUnit(TimeUnit.NANOSECONDS) @BenchmarkMode(Mode.AverageTime) public int directMethodCall() { return IntSum.sum(first, second); } @Benchmark