Uploaded image for project: '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
    • 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

      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.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: