Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4800

Avoid too many temporary arrays with each and eachWithIndex

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.9-beta-1
    • groovy-jdk
    • None

    Description

      In DGM, each and eachWithIndex methods delegate to closure.call(argument) which creates a temporary array for each iteration. We can create the temporary array in the each method itself, then call closure.call(array) instead.

      Another optimization would be to cache the MetaMethod used by the closure, but it would lead to slightly different semantics so we'll leave this for later.

      Attachments

        Activity

          People

            melix Cédric Champeau
            melix Cédric Champeau
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: