Severe invokers performance drop from OpenJDK 7 to OpenJDK 8

Julien Ponge julien.ponge at gmail.com
Thu Oct 10 01:32:24 PDT 2013


Hello,



The runtime of Golo (http://golo-lang.org/) makes several uses of
general invokers (MethodHandles.{invoker,exactInvoker}).



I noticed a severe performance drop when running code on OpenJDK 8.
Perhaps this has something to do with the lambda form backend?



To give you an idea some of my micro-benchmarks stress call sites based
on such invokers.



  * Under OpenJDK 7 or Oracle JDK 7 I get ~0.175s on a machine once the
    JIT stabilises. It aligns with what you get with a static method
    dispatch at an invokestatic call site.
  * Under OpenJDK 8 I get ~0.75s in the same conditions, which is
    severely slower.



I am not doing anything fancy in the Golo runtime, just dispatching
calls where the first argument is method handle, and the remainder are
arguments. One of such call sites bootstrap is as simple as:



public static CallSite bootstrap(MethodHandles.Lookup caller, String
name, MethodType type) {

  return new
ConstantCallSite(MethodHandles.invoker(type.dropParameterTypes(0, 1)));

}



// e.g., (MethodHandle mh, Object a, Object b) => mh.invoke(a, b)



Any idea?



- Julien


More information about the jdk8-dev mailing list