Great tip, thanks a lot!
Looking at that code I was able to cook up something that actually works
in a pretty demanding test-case and doing the transformation in the
CONVERSION phase actually got rid of all the class-lookups.
This currently reduces script-compilation time by a factor of 2-3 and
also greatly reduces the amount of RAM allocated. I still have to figure
out a second problem but this helps a lot!
Thanks again
Wolfgang
Am 29.07.2015 21:59, schrieb Shil Sinha:
> Have you looked at VariableAccessReplacer and its related classes
> in org.codehaus.groovy.transform.tailrec? They might not fit your use
> case as is, but you could probably modify them to do what you want.
>
> On Wed, Jul 29, 2015 at 4:40 AM, Wolfgang Pedot
> <wolfgang.pedot@finkzeit.at <mailto:wolfgang.pedot@finkzeit.at>> wrote:
>
> Hello,
>
> I have the following Scenario:
>
> OSGI-based application with embedded GroovyScriptEngines, lots of
> small(ish) scripts which use variables from the Binding.
> All those Binding-Variables are written in uppercase (like
> constants) to distinguish them from locally used variables in the
> script.
> While looking into recent increases in compile-time for the
> scripts I learned that those uppercase variable names are part of
> the problem because they cause a lot of undesired class-lookups.
> Modifying all the existing scripts would be a giant pain so I
> thought there might be a way to do this using an AST
> transformation, what I would like to do is something like adding a
> lower-case prefix to all uppercase-variables but I cant seem to
> find the right angle.
> Any hints/ideas? Most of the variable-names are known, but some
> are not.
>
> regards
> Wolfgang Pedot
>
>
|