groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jochen Theodorou" <blackd...@gmx.org>
Subject Aw: CompileStatic closure accessing "this object" private variable via setGroovyObjectProperty
Date Tue, 08 Dec 2015 07:57:10 GMT

Gesendet: Montag, 07. Dezember 2015 um 18:12 Uhr
Von: "Winnebeck, Jason" <Jason.Winnebeck@windstream.com>
An: "users@groovy.apache.org" <users@groovy.apache.org>
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

Mime
View raw message