groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: Help with pitching Groovy and Grails
Date Fri, 24 Feb 2017 09:09:56 GMT


On 24.02.2017 10:04, Remi Forax wrote:
> ----- Mail original -----
>> De: "Jochen Theodorou" <blackdrag@gmx.org>
>> À: dev@groovy.apache.org
>> Envoyé: Mercredi 22 Février 2017 22:49:01
>> Objet: Re: Help with pitching Groovy and Grails
>
>> On 21.02.2017 22:51, Raviteja Lokineni wrote:
[...]
>>  well, of course I should
>> also mention that for a example a method call using reflection use to be
>> like factor 30 slower compared with a direct method call using Java. But
>> that is no longer true for a long time.
>
> yes, 30x was a long long time ago, i think before 1.4.2.
> The last time the reflection code was touched for speed update was during the Java 7
timeframe.

but the problem that a reflective call is a inlining barrier is still 
true, or not? Otherwise my expected performance is something like 6-10x 
slower

>> And then in Groovy we use runtime code generation to avoid Reflection and optionally
you could
>> also use the indy port, which is based on invokedynamic (the same one
>> that is used for method calls for lambdas) which can be pretty fast. And
>> if that is not enough, you can still use the static compiler to be
>> around the same level as Java.
>
> Technically, invokedynamic is used from creating the lambda not for calling it,

hehe, right.

> because after creation it's more like a plain reference on an object that implement a
functional interface, so it can be called like a plain old interface. There has been a prototype
to use invokedynamic to call the lambda but performance was identical to an interface call
so it was not integrated because invokedynamic makes the startup a little slower (like reflection
does).

I see.

> In the jdk 9, invokedynamic is used when you do a concatenation with + because invokedynamic
is faster that using a chain of plain old Java calls to StringBuilder.append().

that's the new and improved String handling, yes, I did hear about 
that... But I guess it is a much better example than the one I had

bye Jochen

Mime
View raw message