Gesendet: Montag, 07. Dezember 2015 um 18:12 Uhr
Von: "Winnebeck, Jason" <[email protected]>
An: "[email protected]" <[email protected]>
Betreff: CompileStatic closure accessing "this object" private variable via
setGroovyObjectProperty
I have code with performance issues using closures accessing private fields:
@CompileStatic
class X {
private Y a,b,c
void blah() {
doClosureThing { //This gets run in a loop, 1000s of times
a = …
b = …
c = …
}}}
When profiling, I see the majority of time is spent in
ScriptBytecodeAdapter.setGroovyObjectProperty.
[...]
Is this expected behavior for static compiler?
Since the compiler checks the assignments to a/b/c, it should also create a
direct access to the variables imho. So my answer would be no
bye Jochen