You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2017/05/02 02:03:09 UTC

[jira] [Closed] (GROOVY-7629) ObjectRange methods duplicate functionality and should not rely on size()

     [ https://issues.apache.org/jira/browse/GROOVY-7629?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-7629.
-----------------------------

> ObjectRange methods duplicate functionality and should not rely on size()
> -------------------------------------------------------------------------
>
>                 Key: GROOVY-7629
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7629
>             Project: Groovy
>          Issue Type: Improvement
>          Components: groovy-jdk
>            Reporter: Thibault Kruse
>            Assignee: Paul King
>            Priority: Minor
>             Fix For: 2.5.0-alpha-1
>
>
> The methods iterator(), step(), get(), size() and subList() all step through the range, all having their own stepping implementation, which makes the class more complex than it needs to be.
> Also, get(), subList() and iterator() rely on method size(), which in non-numeric cases does a brute-force iteration over all elements. This causes an unnecessary performance overhead in several cases (even if the value of size() is cached after first computation). The overhead may be arbitrarily large, and in cases the size() exceed MAX_INTEGER, the reliance leads to errors.
> (Also see GROOVY-2972, GROOVY-5426).
> I suggest unifying the stepping semantics and not relying on size(). PR will follow.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)