Hi Jochen,

    > If you want to get the maximum performance then I would suggest to
work
with the guards instead of falling back to a hashed map. 

    Thanks for your suggestions :-)

    After we constructed the following "tree" MH with guards, we have to set
target to link the MH to the related callsite.
>
>       Guard(String)
>       /          \
> MH(same(String)    Guard(Float)
>                    /          \
>        MH(same(float))      Guard(Integer)
>                             /           \
>                 MH(same(int))        Fallback to select


    But the "setTarget" may cause poor performance because JVM may do some
de-opt shown as GROOVY-8298:

```
"qtp2078714399-360525": running, holding [771bcf60]
        at java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(Native
Method)
        at java.lang.invoke.CallSite.setTargetNormal(CallSite.java:258)
        at java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:154)
        at
org.codehaus.groovy.vmplugin.v7.Selector$MethodSelector.doCallSiteTargetSet(Selector.java:909)
        at
org.codehaus.groovy.vmplugin.v7.Selector$MethodSelector.setCallSiteTarget(Selector.java:969)
        at
org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:228)
        at
java.lang.invoke.LambdaForm$DMH/1665404403.invokeStatic_L3IL5_L(LambdaForm$DMH)
        at java.lang.invoke.LambdaForm$BMH/1828868503.reinvoke(LambdaForm$BMH)
        at
java.lang.invoke.LambdaForm$reinvoker/1917025677.dontInline(LambdaForm$reinvoker)
        at java.lang.invoke.LambdaForm$MH/462773420.guard(LambdaForm$MH)
        at 
java.lang.invoke.LambdaForm$MH/1947020920.linkToCallSite(LambdaForm$MH)
```


Cheers,
Daniel.Sun



-----
Apache Groovy committer & PMC member 
Blog: http://blog.sunlan.me 
Twitter: @daniel_sun 

--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Reply via email to