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

Optimizing DefaultGroovyMethods.intersect()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.1-beta-3
    • groovy-jdk
    • None
    • 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

        1. intersect.diff
          1 kB
          Ken Bloom

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: