Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6583

Performance issue when using Groovy pow syntax with InvokeDynamic

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 2.2.1
    • None
    • None

    Description

      Switching my application from standard Groovy distribution to indy one, I get x6/8 slowdown on a testcase.

      I can work it around by changing my script from:

      a=sqrt(b**2+c**2)
      

      to

      a=sqrt(pow(b,2)+pow(c,2))
      

      All time seems to be spent in this kind of stacktrace:

         java.lang.Thread.State: RUNNABLE
      	at java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(Native Method)
      	at java.lang.invoke.CallSite.setTargetNormal(CallSite.java:245)
      	at java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:154)
      	at org.codehaus.groovy.vmplugin.v7.Selector$MethodSelector.doCallSiteTargetSet(Selector.java:758)
      	at org.codehaus.groovy.vmplugin.v7.Selector$MethodSelector.setCallSiteTarget(Selector.java:818)
      	at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:208)
      	at java.lang.invoke.LambdaForm$DMH/1888691344.invokeStatic_LLLILLLLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$BMH/1917855688.reinvoke(LambdaForm$BMH)
      	at java.lang.invoke.LambdaForm$NamedFunction.invoke_L_L(LambdaForm.java:1092)
      	at java.lang.invoke.LambdaForm$DMH/1748585243.invokeStatic_LL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$NamedFunction.invokeWithArguments(LambdaForm.java:1136)
      	at java.lang.invoke.LambdaForm.interpretName(LambdaForm.java:625)
      	at java.lang.invoke.LambdaForm.interpretWithArguments(LambdaForm.java:604)
      	at java.lang.invoke.LambdaForm$LFI/1619763863.interpret_L(LambdaForm$LFI)
      	at java.lang.invoke.LambdaForm$DMH/1114942035.invokeSpecial_LLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$NamedFunction.invoke_LLL_L(LambdaForm.java:1102)
      	at java.lang.invoke.LambdaForm$DMH/1748585243.invokeStatic_LL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$NamedFunction.invokeWithArguments(LambdaForm.java:1136)
      	at java.lang.invoke.LambdaForm.interpretName(LambdaForm.java:625)
      	at java.lang.invoke.LambdaForm.interpretWithArguments(LambdaForm.java:604)
      	at java.lang.invoke.LambdaForm$LFI/1619763863.interpret_L(LambdaForm$LFI)
      	at java.lang.invoke.LambdaForm$MH/1716563771.linkToCallSite(LambdaForm$MH)
      	at PMV14_Julien.computeResistThreshold(PMV14_Julien.asl:395)
      	at PMV14_Julien.this$2$computeResistThreshold(PMV14_Julien.asl)
      	at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:361)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
      	at java.lang.invoke.LambdaForm$DMH/1256194210.invokeSpecial_LLLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$BMH/1293649326.reinvoke(LambdaForm$BMH)
      	at java.lang.invoke.LambdaForm$MH/1613654281.convert(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$MH/182342503.invokeExact_MT(LambdaForm$MH)
      	at java.lang.invoke.MethodHandleImpl$GuardWithCatch.invoke_L3(MethodHandleImpl.java:639)
      	at java.lang.invoke.LambdaForm$DMH/1256194210.invokeSpecial_LLLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$BMH/1293649326.reinvoke(LambdaForm$BMH)
      	at java.lang.invoke.LambdaForm$MH/687771205.convert(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$MH/1024781735.collect(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$MH/1047673184.convert(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$MH/2084298264.convert(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$MH/316610578.invokeExact_MT(LambdaForm$MH)
      	at java.lang.invoke.MethodHandleImpl$GuardWithCatch.invoke_L8(MethodHandleImpl.java:684)
      	at java.lang.invoke.LambdaForm$DMH/387949103.invokeSpecial_LLLLLLLLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$BMH/450141114.reinvoke(LambdaForm$BMH)
      	at java.lang.invoke.LambdaForm$MH/496042224.convert(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$DMH/387949103.invokeSpecial_LLLLLLLLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$MH/356773775.guard(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$DMH/387949103.invokeSpecial_LLLLLLLLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$MH/952757363.guard(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$DMH/387949103.invokeSpecial_LLLLLLLLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$MH/641595078.guard(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$DMH/387949103.invokeSpecial_LLLLLLLLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$MH/270576705.guard(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$DMH/387949103.invokeSpecial_LLLLLLLLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$MH/1842650926.guard(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$DMH/387949103.invokeSpecial_LLLLLLLLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$MH/716782707.guard(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$DMH/387949103.invokeSpecial_LLLLLLLLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$MH/369889140.guard(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$DMH/387949103.invokeSpecial_LLLLLLLLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$MH/555092960.guard(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$DMH/387949103.invokeSpecial_LLLLLLLLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$MH/1697095507.guard(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$DMH/387949103.invokeSpecial_LLLLLLLLL_L(LambdaForm$DMH)
      	at java.lang.invoke.LambdaForm$MH/1684290075.guard(LambdaForm$MH)
      	at java.lang.invoke.LambdaForm$MH/1723182635.linkToCallSite(LambdaForm$MH)
      	at PMV14_Julien$_getInstance_closure7.doCall(PMV14_Julien.asl:254)
      	at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
      	at groovy.lang.Closure.call(Closure.java:423)
      	...
      

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            nicoulaj Julien Nicoulaud
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: