groovy
  1. groovy
  2. GROOVY-3951 Groovy 1.8 runtime performance improvements
  3. GROOVY-3342

Optimization done by groovy compiler by caching number constants does not cover closure classes

    Details

    • Type: Sub-task Sub-task
    • Status: Closed Closed
    • Priority: Minor 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 :
      0

      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.

        Activity

        Hide
        blackdrag blackdrag added a comment -

        since the optimization way for 1.8 is now to use the primitives directly, there is no use for this idea anymore

        Show
        blackdrag blackdrag added a comment - since the optimization way for 1.8 is now to use the primitives directly, there is no use for this idea anymore

          People

          • Assignee:
            blackdrag blackdrag
            Reporter:
            Roshan Dawrani
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: