Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
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.