I'd be curious to know the conclusion on this, it sounds like a scalability 
issue in the parser. I've seen similar behavior in our application, but I've 
not had time to isolate it further. We're still stuck on Groovy 2 because we're 
unable to compile on Groovy 3 because I haven't been able to give the parser 
enough RAM or CPU time. A few hundred MB is OK to compile in Groovy 2 but even 
with multi-GB heap sizes result in out of memory exception in Groovy 3 and 
minutes long compile times.

Jason Winnebeck



Sensitivity: Internal
From: Stephen Mallette <spmalle...@gmail.com>
Sent: Friday, October 16, 2020 2:58 PM
To: users@groovy.apache.org
Subject: groovysh and long input

CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe.

Hello,

I happened to be testing some issues related to this pull request I submitted 
the other day:

https://github.com/apache/groovy/pull/1405<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgroovy%2Fpull%2F1405&data=04%7C01%7Cjason.winnebeck%40windstream.com%7C297adea240524d1b68f708d8720583ef%7C2567b4c1b0ed40f5aee358d7c5f3e2b2%7C0%7C1%7C637384715293498345%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2B4jW23Rl4FZj60uHofA0hq%2FeX4a2yc9Nu1yUltxFQ3U%3D&reserved=0>

In testing between groovy 2.5.x and 3.x I've noticed a considerable performance 
difference when pasting long multi-lined scripts. 2.5.x is quite quick to 
accept the input whereas 3.x seems to slow more and more as additional lines 
are consumed. While I did more complex tests trying to get to the bottom of the 
problem, it's fairly easy to recreate with a simple addition script:

1 + 10 +
1 + 10 +
1 + 10 +
1 + 10 +
1 + 10 +
... repeated a bunch of times and then ended with
1

copy that out of your text editor and just paste it into both versions of 
groovsh and see the difference. I've found 500 lines demonstrates it well but 
you could probably get away with less and still see the difference of 
evaluation at play.

I tried to do some profiling to try to isolate the problem myself, but things 
got a little too deep into antlr4 for me and I got lost. Does anyone have any 
ideas as to what might be different for 3.x?


Reply via email to