Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.7.5
-
Fix Version/s: None
-
Component/s: groovy-jdk
-
Labels:None
-
Number of attachments :
Description
DefaultGroovyMethods.unique has two inner loops, so its complexity is O(n^2)
Practically it means that it starts taking ages on collections with 1000 or more elements.
Simply adding elements to a linked hash set would get O(n*log n) performance.
Will develop my own unique implementation after New Year, and will attach it here
Issue Links
- is related to
-
GROOVY-4341
DefaultGroovyMethods#unique O(nē) performance
-
Worth also looking at the comments on
GROOVY-4341- not trying to put you off but just noting the desired functionality for that method from the respective comments.