groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <>
Subject [jira] [Commented] (GROOVY-4606) Exteremely bad performance of .unique() and .unique {closure}
Date Mon, 16 Apr 2018 12:21:00 GMT


Paul King commented on GROOVY-4606:

Given that we now have methods like {{DGM#toUnique(List, Comparator)}} and you can use {{Comparator.naturalOrder()}}
to avoid coercion, should we close this issue or apply it as a small performance boost when
using {{unique}}? I think it would belong inside the private {{uniqueItems}} method these

> Exteremely bad performance of .unique() and .unique {closure}
> -------------------------------------------------------------
>                 Key: GROOVY-4606
>                 URL:
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-jdk
>    Affects Versions: 1.7.5
>            Reporter: Maxym Mykhalchuk
>            Priority: Major
>         Attachments:
> 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

This message was sent by Atlassian JIRA

View raw message