groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <>
Subject Re: Optimizing groovy performace
Date Sat, 16 Apr 2016 11:27:21 GMT
Firstly sorry for not answering so fast. I have not so much spare time 
these days :( And your question requires some thought

On 11.04.2016 12:58, Serega Sheypak wrote:
> *>do you reuse the scripts, or do you make a new script each time?*
> I suppose I do reuse, please have a look at "ScriptFactory"
> *Hi, here is naive caching factory:*
> *>To give an advice I have to understand your setup better first*
> I run topology.
> If you are not familiar with it, assume I have a running thread-safe
> java application. Java application keeps 1000 User objects and 20
> GroovyScripts in memory.
> I run 1000 (users) *20 (script: def evaluateExpression(Map context))
> executions each second.
> If script for User object returns true, I do something special.
> I try to cache script instances (see my gist).
> User object is just a bean with some logic incapsulated.

if I now assume this will start 1000 threads, each with its own cache, 
then you get 20k compilations, as well as 20k first time executions. 
Doing all that unreflection in the indy part and creating those 
MethodHandles always takes a little time. So it might very well be, that 
this is the problem, but not sure what we could do then.

Is it somehow possible to get a small running program showing the 
problem? Then I could check myseld what really happens. JVisualVM helps 
a bit, but is imho no proper replacement for a real profiler.

bye Jochen

View raw message