Re: Groovy 5 - Performance / @CompileStatic

James Daugherty <[email protected]>
Newsgroups gmane.comp.lang.groovy.devel
Message-ID <CAMGZ+-_dQFgXCLi3qscPgwv2WcTt+V9c8aUwFg9pzsjCQae7zQ@mail.gmail.com>
Hi Everyone,

This performance issue was recently brought up as a Grails ticket
(https://github.com/apache/grails-core/issues/15293).  We haven't
switched to Groovy 5 yet, but it would be nice if we could improve the
performance prior to switching.  Was any progress ever made on this
thread?  @Jochen & @Miles?

The user was kind enough to include a test application with Grails 7
to help research these performance issues.  From their research they
indicated the slow downs were mostly in Groovy code.  Unfortunately,
the application is for Groovy 4 since Grails isn't on Groovy 5 yet.
(We still don't have Groovy 5 compiling with Grails and are gradually
opening tickets / working on these as we can in this PR chain
https://github.com/apache/grails-core/pull/15183).

-James

On Thu, Aug 21, 2025 at 11:55 AM MG <mgbiz-yvYIh6MZAuFWk0Htik3J/[email protected]> wrote:
>
> Hi Jochen,
>
> since, as I said, we could not pinpoint any specific, smaller piece of code that exhibits the problem, we can alas not supply a test case.
> But if you guys want to try out this 80% (?) quick fix solution, I can offer to test it with our framework, as soon as we have successfully switched to Groovy 5.
>
> Cheers,
> mg
>
>
> Am 14.08.2025 um 09:38 schrieb Jochen Theodorou:
>
> That would be very much appreciated. My problem is a bit the "where to start while having something real life testable"
>
> and maybe something like
>
> callsite.paths = [SLOW_PATH_0, current logic]
> callsite.counter = 0
>
> callsite target = {
>   if (counter < THRESHOLD) {
>     increase counter
>     continue with paths[0]
>   } else {
>     continue with paths[1]
>   }
> }
>
> as a first step would already help a bit and would be near the final solution I drafted in my mail as well
>
> bye Jochen
>
> On 13.08.25 22:11, Milles, Eric (TR Technology) via dev wrote:
>
> I have been following the discussion.  Jochen, if you want to work together on a prototype for this, I can surely help.
>
> ------------------------------------------------------------------------
> *From:* Jochen Theodorou <[email protected]>
> *Sent:* Wednesday, August 13, 2025 2:28 PM
> *To:* dev-GSC0n/0aZo1d/SJB6HiN2Ni2O/[email protected] <dev-GSC0n/0aZo1d/SJB6HiN2Ni2O/[email protected]>
> *Subject:* [EXT] Re: Groovy 5 - Performance / @CompileStatic
> External Email: Use caution with links and attachments.
>
> On 10.08.25 22:59, MG wrote:
> [...]
>
>   3. But, most importantly, as Jochen stated in his last reply: "Yes, in
>      the end MethodHandles are faster, but only once optimizations have
>      run. /And that takes thousands of iterations/. MG for example has
>      been hit by this."
>       1. So he thinks he already knows what causes the performance
>          degradation when using Groovy indy, and already points out some
>          way(s) to improve this (independent of the specifics our project)...
>
>
> I think it is the cost of initialization. We have to keep that much
> lower than we do right now. Sadly you are the only reacting to that mail
> so far. I thought I kept it simple enough...
>
> bye Jochen
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.