Details
-
Type:
Sub-task
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 1.6-rc-1, 1.6-rc-2
-
Fix Version/s: None
-
Component/s: Compiler
-
Labels:None
-
Number of attachments :
Description
From version 1.6.x onwards, groovy compiler caches the number constants to optimize the runtime performance. Currently it is done only for top-level classes and not for classes that get generated for closures.
So, If I say
def cl = {
1000.times{
def i = 10
println i
}
}
cl()
Constants 10 and 1000 are not cached and Integer object for value 10 gets created 1000 times. Optimization done for top-level classes is needed even for inner classes that get generated for closures.
since the optimization way for 1.8 is now to use the primitives directly, there is no use for this idea anymore