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

Optimizing DefaultGroovyMethods.intersect()

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1-beta-3
    • Component/s: groovy-jdk
    • Labels:
      None
    • Flags:
      Patch

      Description

      The current version of DefaultGroovyMethods.intersect can be improved for better performance, by using a HashSet instead of a TreeSet, and by swapping the two collections if necessary, so as to iterate across the smaller one. Rather than being O(n log m) with n possibly much larger than m, performance increases to O where n is the smaller of the two Collections.

      I've attached a patch.

        Attachments

          Activity

            People

            • Assignee:
              blackdrag Jochen Theodorou
              Reporter:
              kbloom Ken Bloom
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: