Search code examples
javagroovyinvokedynamic

How much will JSR-292 (invokedynamic) do to Groovy performance?


Is there an estimate that says how much JSR-292 will impact Groovy performance?


Solution

  • invokedynamic is a complicated story really, since the performance characteristics changes all the time in JDK7. During porting Groovy to indy I got really, really near Java, about factor 1.5. But I have to use the catchExceptionGuard, which reduces performance to something like being factor 3-4. We still need to investigate ways to avoid having to use that guard. Maybe we will have to break some existing code in Groovy 2.2 for that. Anyway, I don't need the guard for the invokeMethod fallback as mentioned above. It is for GroovyRuntimeExceptions possibly containing other exceptions, that I have to unwrap or do other things with. So the theoretical possible performance seems to be between Java and half of Java speed for existing methods. Performance of calls to invokeMethod is a whole different story.

    If you need more, then use @CompileStatic in Groovy 2.0.